Re: Robot doesnt respond to some remote buttons????
Let's run through the code real quick, and I think the answer will become clear. You want to move the Lift motor up when button 6U is pressed, down when 6D is pressed, and stop it when neither button is pressed, correct? You are definitely on the right track, but have run into one of the common errors when using remote control with buttons; multiple if/else statements controlling the same motor.
For example, let's say you press the 6U button. The first if/else statement checks the state of 6U, turns the motor on if it is pressed, and turns it off if it is not pressed:
So far so good; if the 6U button is pressed, the motor will move; if it's not, the motor will stop. Looking at the next set of if/else statements, though, the issue starts to make itself clear:
In this case, only button 6U is pressed; since 6D is not
pressed, the else statement in this case becomes true, and the motor is immediately shut back off. What you will normally see in this case is jerky, stuttering movement as the motor is continually and quickly turn off and on.
To solve this, you will need to consolidate the two if/else sets into a single if/else if/else set. Fortunately, we have a VEX Cortex Video Trainer Curriculum section dedicated to this exact issue (it even uses the same buttons, 6U and 6D, as you are using. You can find it here
, under the 'Remote Control -> Buttons -> Controlling the Arm Part 1-3'. This should solve the issue for you, and can be applied to the 'Arm' section of code as well.
Check out our Blog
! And our Facebook page
Need help? Take a look at our Wiki
and our Forums.I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody