Code:
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, none)#pragma config(Sensor, S2, rangeFront, sensorSONAR)
#pragma config(Sensor, S3, rangeLeft, sensorSONAR)
#pragma config(Sensor, S4, rangeRight, sensorSONAR)
#pragma config(Motor, motorA, , tmotorNormal, openLoop)
#pragma config(Motor, motorB, , tmotorNormal, openLoop)
#pragma config(Motor, motorC, , tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_1, motor2, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, motor4, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_1, motor3, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_2, motor1, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C3_1, elevator, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C3_2, claw, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"task main(){waitForStart(); int x1Val = 0; int y1Val = 0;int x2Val = 0; int y2Val = 0; int boundBox = 20;int scale = 5;int motor1Val = 0;int motor2Val = 0; int motor3Val = 0; int motor4Val = 0;while (true){getJoystickSettings(joystick);if(abs(joystick.joy1_x1) > boundBox){x1Val = joystick.joy1_x1 / scale;}else{x1Val = 0;}if(abs(joystick.joy1_y1) > boundBox){y1Val = joystick.joy1_y1 / scale;}else{y1Val=0;}if(abs(joystick.joy1_x2) > boundBox){x2Val = joystick.joy1_x2 / scale;}else{x2Val = 0;}if(abs(joystick.joy1_y2) > boundBox){y2Val = joystick.joy1_y2 / scale;}else{y2Val = 0;}motor1Val = -y1Val - x1Val - x2Val;motor2Val = y1Val - x1Val - x2Val;motor3Val = -y1Val + x1Val - x2Val;motor4Val = y1Val + x1Val - x2Val;if(joy1Btn(5)){motor1Val = motor1Val * scale;motor2Val = motor2Val * scale;motor3Val = motor3Val * scale;motor4Val = motor4Val * scale;}motor[motor1] = motor1Val;motor[motor2] = motor2Val;motor[motor3] = motor3Val;motor[motor4] = motor4Val;}}
And if it is not obvious what the code does, it is to control a robot with H