We can change the button or joystick action by “Teleop” program and I want to know how to create the below action;
if I switch the joystick to the horizontal direction, one motor(connected to ch10, for example) rotates,
and if I switch the same joystick to the vertical direction, another motor(connected to ch11, for example) rotates.
I know we can operate two Drive Motor(connected to ch1 and ch6) by operating one joystick.
(the code is “arcade control (chA, chB, 10)”, isn’t? )
And I want to move two more motors for arm part by operating another joystick.
@calvc01 's solution works, but that is not an ideal way to do it. Any time you’re reading a value and using it with the expectation that it’s the same, you should only read it once. Frequently it won’t matter, but there are times when it will, and those times will really bite you. Also, it’s faster to read a sensor only once and use the same value repeatedly instead of reading the sensor repeatedly. So a better way to write this would be:
int forwardDrive = 0;
int turnDrive = 0;
int armDrive = 0;