I'm running into a problem on Arduino.
I want my Arduino listen to input from a piece of 12 key's keypad, this is easy, there is already keypad library avaliable.
I want to display time on a 16X2 lcd screen that I read from a RTC module, update per second. This is also easy, implemented already.
BUT, when I try to combine these two tasks, to make arduino listen keypad and keep updating the lcd, there is trouble: I'm using a delay(1000) to tell arduino loop per second, which works for updating time on lcd, but it somehow blocks the keypad listening.
Is there any solutions for this thing? Like multithreading or other clever workaround?
delay
, how about measureing the time usingmillis()
and run needed process after whenmills() - lastRunTIme >= 1000
?lastRunTime
should be the last time when the process invoked and be meacured viamillis()
– MikeCAT