 | Code: #pragma config(Hubs, S1, HTMotor, HTMotor, none, none) #pragma config(Hubs, S2, HTMotor, HTMotor, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Sensor, S2, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C1_1, motor1, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C1_2, motor2, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_1, motor3, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_2, motor4, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S2_C1_1, motor5, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S2_C1_2, motor6, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S2_C2_1, motor7, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S2_C2_2, motor8, tmotorTetrix, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; }
int a = joystick.joy1_y1; int b = joystick.joy1_y2; int c = joystick.joy1_x1; int d = joystick.joy1_x2; int e = joystick.joy1_Buttons;
int mVal1 = map (a, -123, 123, -25, 25); int mVal2 = map (b, -123, 123, -25, 25); int mVal3 = map (c, -123, 123, -25, 25); int mVal4 = map (d, -123, 123, -25, 25);
task main() { while(true) { getJoystickSettings(joystick);
motor[motor1] = 100;\ motor[motor2] = 100; motor[motor3] = 100; motor[motorF] =100; }
} |  |