Pages: [1]   Go Down
Author Topic: Need help for a special LCD function  (Read 216 times)
0 Members and 1 Guest are viewing this topic.
Norway
Offline Offline
Full Member
***
Karma: 1
Posts: 138
likes to program Arduinos!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Norway
Offline Offline
Full Member
***
Karma: 1
Posts: 138
likes to program Arduinos!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46204
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

East Anglia (UK)
Online Online
Faraday Member
**
Karma: 90
Posts: 3509
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please post your whole program so that we can give advice on how to implement timing using millis()
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: