|
A good time based way to program
Whenever my mentors ask me if I can program a motor to run for x seconds, I always feel it's not the best way to do that.
For example, press a button and the motor will run for x seconds and then stop.
All I can think of to do that is simply using Timer() class, but then I feel using multiple timers, if else's for them is not just the best way to do it.
Is there any other better way to do this or is using Timer() fine?
All your thoughts are much appreciated!
|