Code: #pragma config(Sensor, S4, IRseeker, sensorNone) #pragma config(Motor, mtr_S1_C1_1, East, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C1_2, West, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_1, North, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_2, South, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C3_1, Lift, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C3_2, None, tmotorTetrix, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
task main() { while(true) { getJoystickSettings(joystick);
if(joystick.joy1_y1 > 40 || joystick.joy1_y1 < -40 ) { motor[West] = -joystick.joy1_y1/2; }
if(joy1Btn(5) == 1 && (joystick.joy1_y1 > 40 || joystick.joy1_y1 < -40)) { motor[West] = -joystick.joy1_y1/8; }
if(joystick.joy1_y1 < 40 && joystick.joy1_y1 > -40) { motor[West] = 0; }
if(joystick.joy1_y2 > 40 || joystick.joy1_y2 < -40) { motor[East] = joystick.joy1_y2/2; }
if(joy1Btn(5) == 1 && (joystick.joy1_y2 > 40 || joystick.joy1_y2 < -40)) { motor[East] = joystick.joy1_y2/8; }
if(joystick.joy1_y2 < 40 && joystick.joy1_y2 > -40) { motor[East] = 0; }
if(joystick.joy1_x1 > 40 || joystick.joy1_x1 < -40) { motor[North] = -joystick.joy1_x1/2; }
if(joy1Btn(5) == 1 && (joystick.joy1_x1 > 40 || joystick.joy1_x1 < -40)) { motor[North] = -joystick.joy1_x1/8; }
if(joystick.joy1_x1 < 40 && joystick.joy1_x1 > -40) { motor[North] = 0; }
if(joystick.joy1_x2 > 40 || joystick.joy1_x2 < -40) { motor[South] = joystick.joy1_x2/2; }
if(joy1Btn(5) == 1 && (joystick.joy1_x2 > 40 || joystick.joy1_x2 < -40)) { motor[South] = joystick.joy1_x2/8; }
if(joystick.joy1_x2 < 40 && joystick.joy1_x2 > -40) { motor[South] = 0; }
///////////////////////////////////////////////////////////////
if (joystick.joy1_TopHat == 4) { motor[Lift] = -10; } if (joystick.joy1_TopHat == -1) { motor[Lift] = 0; } if(joystick.joy1_TopHat == 0) { motor[Lift] = 50; } } }
|