Looking to see what it’s like to program one speed for lift to say, buttons 5d and 5u and a “softer” speed to the 6d 6u buttons. Do we need encoders? Could someone give us a little sample code? Thanks in advance!
Use a series of conditional statements that test the buttons and set the lift motor(s) accordingly.
#pragma config(Motor, port1, liftMotor, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
while(1) {
if( vexRT Btn5U ] ) {
motor liftMotor ] = 127;
}
else
if( vexRT Btn5D ] ) {
motor liftMotor ] = -127;
}
else
if( vexRT Btn6U ] ) {
motor liftMotor ] = 70;
}
else
if( vexRT Btn6D ] ) {
motor liftMotor ] = -70;
}
else {
motor liftMotor ] = 0;
}
wait1Msec(20);
}
}