Go Down

Topic: Need help for a special LCD function (Read 283 times) previous topic - next topic

hansibull

Hi!
I'm i an middle of an amplifier project, and this amp is going to have an i2c driven LCD.
I've hooked it up, and got everything working, but i have one issue. (i'm using the LiquidCrystal_i2c.h library)
when the amp is running normally, the LCD is showing the source (AUX, CD, TAPE etc.), but when I turn up the volume (with a remote or a rotary switch) I want the LCD to show "Vol: x". the thing is that I want the current volume to be shown i a couple of seconds, and then turn back to normal (show the source input). if I continue ut adjust the volume while the LCD is showing "Vol: x", the LCD updates and print immediately the new volume value "Vol: x+-1"

if I write:

          lcd.clear();
          volume_up();
          lcd.print("Vol: ");
          lcd.print(i);
          delay(1500);
          lcd.clear();
         lcd.print(current_source);

It's not possible to adjust the volume before the arduino have waited 1500ms.

Here is a video of my old amp, showing exactly what I mean:

http://www.youtube.com/watch?v=y901H52oK_E&feature=youtu.be

majenko

You need to take a look at the BlinkWithoutDelay example.

Record the time when you adjust the volume, and when that time differs from the current time by 2 seconds (or whatever you choose) switch the display back to the source display.

Personally I usually have a "display mode" variable which defines what should be shown at the time, then a function which displays what should be displayed depending on the display mode selected.  Then the main routine just selects a different display mode as and when it needs to.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

hansibull

I've looked at the blink without delay sketch, but how should I imliment it? do you have an example I can work on?

PaulS

Quote
but how should I imliment it?

The same way it was done in the example.

Quote
do you have an example I can work on?

Didn't you just look at one?

Write down, in words, not code, what you need to do, and when you need to do it. Translating that to code is easy. Knowing what to do is the hard(er) part. It's time for you to demonstrate that you DO know what needs to be done.

UKHeliBob

Please post your whole program so that we can give advice on how to implement timing using millis()
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up