|
RoboTeacher
Rookie
Joined: Sat Jun 27, 2009 4:52 pm Posts: 7
|
 robotc main program help
My program will only allow me to use the joysticks to control the drive motors. The code seems to read just the joysticks in this program. The buttons seem to not work. Is this an error in my code, or a glitch in the program?
This is the troublesome program:
#pragma config(Hubs, S1, HTMotor, HTMotor, HTServo, none) #pragma config(Sensor, S2, downy, sensorTouch) #pragma config(Sensor, S3, uppy, sensorTouch) #pragma config(Sensor, S4, batman, sensorSONAR) #pragma config(Motor, motorA, spinny, tmotorNormal, openLoop) #pragma config(Motor, motorB, belty, tmotorNormal, openLoop, reversed) #pragma config(Motor, motorC, spinnie, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C1_1, rrr, tmotorNormal, openLoop, reversed, encoder) #pragma config(Motor, mtr_S1_C1_2, lll, tmotorNormal, openLoop, encoder) #pragma config(Motor, mtr_S1_C2_1, liftarm, tmotorNormal, openLoop, reversed, encoder) #pragma config(Motor, mtr_S1_C2_2, motorG, tmotorNormal, openLoop) #pragma config(Servo, srvo_S1_C3_1, , tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
task main() { int threshold = 20; getJoystickSettings(joystick); //servoChangeRate[servoright] = 2; //servoChangeRate[servoleft] = 2; { while(true)
{ if(abs(joystick.joy1_y2) > threshold) { motor[rrr] = (joystick.joy1_y2); } else { motor[rrr] = 0; } if(abs(joystick.joy1_y1) > threshold) { motor[lll] = (joystick.joy1_y1); } else { motor[lll] = 0; } }
} }
Thank you.
|