Go Down

Topic: Dynamic variables on 20x4 LCD i2c (Read 153 times) previous topic - next topic

aj_mega

Hi all,

I am working on a project where i am using the following:
- Arduino Mega 2560
- Push-button
- 10K pull-down resistor
- multiple sensors.

What i want to do is the following:
I want to connect my 20x4 LCD trough i2c and display my measuring values.
I have everything working except one thing..

Because I do have a lot of measurements going, a 20x4 LCD is not big enough to display all my variables.
That's why i have made a so called page toggle, which makes it possible to display a couple measurements on on page and show the rest when pushing the button.
(And yes i have debounced it already :-) )

What my problem is:
- The measurements are dynamic, but they won't refresh on the LCD unless i press and release the button.

Since i am not a superstar in programming, i am really hoping someone can help me solving this.

I have attached my code.
Please let me know if you need some additional information.

Thanks in advance  :)



ieee488

If you don't want to use the push button then you'd need some sort of timer to in your code to know when it is time to display the second page.

aj_mega

If you don't want to use the push button then you'd need some sort of timer to in your code to know when it is time to display the second page.
Thanks for the idea, it could work but i am just looking for some 'minor' software changes.
I do want to keep the push-button installed, this makes it possible to switch screens whenever i want.
With a timer i don't have the possibility to see the data i need ( or i have to wait for some time) and when i have my data it will be dissapearing while looking at it.

i hope you understand what i just explained.  :smiley-sweat:


david_prentice

Go on.   Look at every other item with a small display.  e.g. wristwatch,  Alarm Clock,   central heating controller, ...
Some alternate the screen every second.   Or change after a time.
Others use a mode button.    Sometimes a long press is different to a short press.

Think about which style you want to use.    Or invent a new style.

A regular Timer interrupt is a good way to do things.   e.g. check for button state every 50ms.

When you have chosen how you want it to "look and feel" for the user,   ask for advice on how to implement your  design.

David.

aj_mega

Hi all watchers,

i have managed to fix this problem.
now i have an 'old' problem and that contains flickering of my LCD.

What happens with my code is the following:
The lowest two rows are 'flickering', which results that the third row is flickering a bit but still visable..
but the fourth row is also flickering but is barely visable.

any idea's to fix this ?


The new code is attached!

Thanks in advance!

P.s. :david_prentice  and ieee488, Thanks for replying and giving me some tips and stuff to think about.


Go Up