|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Toggling Between Two buttons
Code:
if button.pressed():
if !buttonWasPressed:
buttonWasPressed = True
motorSet = 1 - motorSet
else:
buttonWasPressed = False
motor.set(motorSet)
|
|
#2
|
|||
|
|||
|
Re: Toggling Between Two buttons
Quote:
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. |
|
#3
|
|||
|
|||
|
Re: Toggling Between Two buttons
Quote:
Note that as it stands once one of these two buttons is pressed and the motor turns on, there is no way to turn it off again. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|