I am trying to implement a progress/status bar on the 16x2 LCD for a defined period of time. Previously I did it with delay() function, which worked beautifully in displaying but due to its blocking nature, I cannot run any other code during that time.
Now, using the millis() function, I am trying to implement the same. The logic here that I am using is to break the time period in 16 equal segments and after a check at each segment the code displays the byte in the next display slot. but the display is not running for the same time.
I would be utterly grateful for any help that can make it work.
When debugging conditional statements such as while and if it is useful to print the values being tested before testing them. Have you tried that and if so, are the values printed what you expect and are they printed when you expect to see them ?
I introduced a Serial.print() command inside the 'if' loop to see the values. Every output is coming two times and hence the progress status bar is completing early than the time period(4 seconds in this case). However, I dont know why it is coming two times and how should i circumvent it?