help with button programming

  1. 5 weeks ago

    hello we are in need of help with our program. we are trying to code our catapult and ran into problems. when we push a button it will set out potentiometer to start when its under 500 and stop when its over 2000

    if (vexRT[Btn7L] == 1) && SensorValue(potentiometer) < 500)
    {
    motor[port10] = 84;
    motor[port5] = 84;

    }
    else if (SensorValue(potentiometer) < 2000)
    {
    motor[port10] = 0;
    motor[port5] = 0;
    }
    else
    {
    motor[port10] = 0;
    motor[port5] = 0;

  2. last week

    jpearman

    Jan 9 Moderator, ROBOTC Tech Support, V5 Beta Moderator Los Angeles 8888

    I assume you have this sorted out by now, however, the first "if" statement is missing a parenthesis

    if (vexRT[Btn7L] == 1) && SensorValue(potentiometer) < 500)

    should be

    if ( (vexRT[Btn7L] == 1) && SensorValue(potentiometer) < 500 )
 

or Sign Up to reply!