|
Re: Checking Rookie Programmer's code to switch between motors
While there are certainly ways to make a single button push switch from one mode to another, the easiest thing (if I'm interpreting your code correctly) would be to just hold down Button 11. Otherwise, you'll have to add a shift register and/or global variable to keep track of when you press the button. You'd only want to change states when you just pressed the button, meaning a) the last time through, the button wasn't pressed, AND b) this time, the button is pressed. So you'd have to store what the button was the last time, recall it, compare it to what the button is this time, and only make a change when Last Time = False and This Time = True.
|