|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#4
|
||||
|
||||
|
Re: Running different functions at the same time?
The good (and bad) thing about motors is if you don't tell them what to do, they'll do the last thing they were told. This means if you forget to set a motor to 0 when you're done with it it will stay turned on. You can use this to your advantage
Code:
if state == 1:
motor.set(1)
state = 2
if state == 2:
do_pneumatic_stuff()
#because the motor hasn't been set to 0, it's still set to 1
if pneumatic_stuff_done:
state == 3
if state == 3
motor.set(0) #Now we set it to 0 to stop it
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|