button program

  1. 2 days ago

    Hello I am trying to program a button to my remote but it will not work any feed back is awesome thank you.

    task main()
    {
    while(true)

    If(vexRT[Btn6U]==1);
    {
    motor[rightclaw]=127;
    }
    else if (vexRT[Btn6D]==1)
    {
    motor[rightclaw]= -127;
    }
    else
    {
    motor[rightclaw]=0;
    }
    }

    You're missing curly braces for the while loop. This is what your code should look like:

    task main()
    {
    	while(true)
    	{
    		if(vexRT[Btn6U] == 1)
    		{
    			motor[rightclaw] = 127;
    		}
    		else if (vexRT[Btn6D] == 1)
    		{
    			motor[rightclaw] = -127;
    		}
    		else
    		{
    			motor[rightclaw] = 0;
    		}
    	}
    }
  2. yesterday

    mwang17

    yesterday Denver, Colorado 3946E
    Edited yesterday by mwang17

    Your code looks good. Check the wiring, that would be my first guess.

    Oh lol totally missed the braces for the while loop.

  3. This is what it is saying.

  4. Team180vrc

    yesterday Haymarket, VA 180

    The "if" needs to be lowercase...

  5. NightsRosario

    yesterday Maryland 3922A

    I don't know if RobotC is finnicky with these kinds of things, but I think you're missing curly braces for the while loop.

  6. lacsap

    yesterday Event Partner Massachusetts 9791[a-z]
    Edited yesterday by lacsap

    Missing { } for the while loop. No?
    [missed NightsRosario post -- agreed with {} ]

  7. Riley

    yesterday Answer United Kingdom 3116C
    Edited yesterday by Riley

    You're missing curly braces for the while loop. This is what your code should look like:

    task main()
    {
    	while(true)
    	{
    		if(vexRT[Btn6U] == 1)
    		{
    			motor[rightclaw] = 127;
    		}
    		else if (vexRT[Btn6D] == 1)
    		{
    			motor[rightclaw] = -127;
    		}
    		else
    		{
    			motor[rightclaw] = 0;
    		}
    	}
    }
  8. Ok thank you guys for your help.

 

or Sign Up to reply!