hello, I’m trying to make my motors change speed by the press of a button I currently have them at half speed and when I push x it should change it to full speed and I don’t know what to do or how to fix kinda stuck here.
here’s my code…( i apologize for the sloppiness plan on making it more pretty later)
int x;
x = 0;
if(x == 0)
{
if (master.get_digital(DIGITAL_L1)) //arm up
{
left_arm.move_velocity(-100);
right_arm.move_velocity(-100);
}
else if(master.get_digital(DIGITAL_L2)) //arm down
{
left_arm.move_velocity(100);
right_arm.move_velocity(100);
}
else
{
left_arm.move_velocity(0);
right_arm.move_velocity(0);
}
}
//----------------------------------end of arm function
if(master.get_digital(DIGITAL_X))
{
x = 1;
}
if(x == 1)
{
if (master.get_digital(DIGITAL_L1)) //arm up
{
left_arm.move_velocity(-200);
right_arm.move_velocity(-200);
}
else if(master.get_digital(DIGITAL_L2)) //arm down
{
left_arm.move_velocity(200);
right_arm.move_velocity(200);
}
else
{
left_arm.move_velocity(0);
right_arm.move_velocity(0);
}
if(master.get_digital(DIGITAL_B))
{
x = 0;
}
}