To multitask with an arduino or something close to it. I am trying to update a LCD (countdown) and and use a microswitch to control a motor at the same time. I’m using while loops to control the motors and if statements for the LCD updating. The LCD will update as soon as the microswitch is released. Is there a way that I can get the LCD to update while in a while loop?
Will allow countdown, but motors are stop and go as I change the time interval I will lose one or the other. So far I can’t find a happy middle ground.
UKHeliBob:
How will millis() - timestop ever be greater than 600 ? timestop is never updated in that while loop.
Did you look at the link that Robin gave you ?
Yes. I have tried all of the following and it was the same as a regular IF statement. The motors would not move and the LCD would update.
In all of your examples you set timestop to millis() when the button is pressed. What you need to do is to record the time when the button becomes pressed.
Have a look at the StateChangeDetection example in the IDE