2004 LCD with a mega 2560, without using delay

Hello,

I have a project, where I want to show data on a LCD screen. Typical time, voltage, current, pressure etc. But I don't want to use delay so that the program have to stop every cycle it runs trough the loop. Do you know of a I2C example using millis instead of delay?

Thank you

Look at Blink Without Delay. What you put in that if statement doesn't have to be a blinking led. It works exactly the same no matter what you want to put in there. It's a concept you really must learn.

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Why would you want to use a delay? What model Arduino are you using? What LCD display? How are you measuring all those inputs?

Can you tell us your electronics, programming, Arduino, hardware experience?

Thanks. Tom... :)

Using an LCD display, typically only uses delays() once during initialisation… maybe 3mS total. In setup() there is rarely a penalty for calling delay()

Then - during display writes in your (main) loop(), the imposed LCD overheads will usually be tiny… in the single digit microSeconds.
You’re right - other delays will be generated within your code, and should eventually be timed with millis().

Keep posting, we’re happy to help you learn.

After the display has been initialized, the only real purpose of using a delay with the LCD is to make the data presented viewable. A display full of data changing so fast everything is a blur is pretty much useless. I'm wondering if another method of slowing the display down would be to have the display function count the number passes through the loop which calls the display function, and only execute the display function after Xn number of passes.

If you count loop passes then the timing may vary as loop times may not be consistent. Using millis would require very similar code but would keep the timing consistent.