View Single Post
  #4   Spotlight this post!  
Unread 03-02-2016, 15:58
T3_1565 T3_1565 is offline
Registered User
AKA: Twitch Drive Designer
FRC #1360
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2005
Location: Burlington, Ontario
Posts: 855
T3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant futureT3_1565 has a brilliant future
Send a message via MSN to T3_1565
Re: Toggling Between Two buttons

Quote:
Originally Posted by Arhowk View Post
Code:
if button.pressed():
    if !buttonWasPressed:
         buttonWasPressed = True
         motorSet = 1 - motorSet
else:
         buttonWasPressed = False

motor.set(motorSet)
python pseudocode
That doesn't seem like what he is asking for.

I'm not a programmer at all but I think a variable is the correct way to deal with your request.

if Button A is pressed then set variable "X" to 1.
if Button B is pressed then set variable "X" to 2.
if "X" = 1 then Motor runs one way
if "X" = 2 then motor runs the other way

Again. Not a programmer. Just how your request sounds in my head.