I wanted to make a toggle button for my shooter, this is the code:
}#pragma config(Motor, port1, LeftDrive, tmotorVex393_HBridge, openLoop, reversed)
#pragma config(Motor, port2, RightDrive, tmotorVex393_MC29, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task main()
{
int toggle;
toggle = 0;
while(1 == 1)
{
if(toggle == 0)
{
if(vexRT[Btn7D] == 1)
{
toggle = 1;
}
else if(vexRT[Btn8D] == 1)
{
motor[LeftDrive] = 63;
motor[RightDrive] = 63;
}
}
else if(toggle == 1)
{
if(vexRT[Btn7D] == 1)
{
toggle = 0;
}
else if(vexRT[Btn8D] == 1)
{
motor[LeftDrive] = 127;
motor[RightDrive] = 127;
}
}
}
}
Can you tell me what I did wrong?