Displaying a variable readout on Nokia 3310 LCD?

I managed to display Text Messages on Serial LCD (Nokia3310), using a sketch I found on this forum.

What command can I use to display a variable number (analog readout of a sensor) on it?

I can display it on my PC using the serial function, but are still unable to get the right code for the Serial LCD feed.

Thanks for any help

I'm looking for the same answer. Do let me know if you have found it

cheers

I was away on holiday for a long time. Just restarted with my project.

With the help of FireBALL my code for Serial LCD (Nokia3310) is working fine.

I need to display a variable from an Analog pin on the LCD.

Can someone help?? of guide me in the right direction,

Please

int val = analogRead(pin);
lcd.print(val);

?

Hi, thanks but in the LCD code Lcd.print was not declared.

I manage to do this with the following code. Maybe there are a easier way but it is working fine for me. I did not include the last digit code because I don't need it my self, but will be easy ad.

int Th = analogRead(POT_ANALOG_PIN);

LcdGotoXY(1,5); // Max 14 X (hor) and 6 Y (Ver)

int v1; // create variable v1 Variable 1
if(Th >= 0 && Th <=1000){LcdStr(1, "0"); v1 = 0;}
if(Th >= 999 && Th <=2000){LcdStr(1, "1"); v1 = 1000;}
if(Th >= 1999 && Th <=3000){LcdStr(1, "2"); v1 = 2000;}
if(Th >= 2999 && Th <=4000){LcdStr(1, "3"); v1 = 3000;}
if(Th >= 3999 && Th <=5000){LcdStr(1, "4"); v1 = 4000;}
if(Th >= 4999 && Th <=6000){LcdStr(1, "5"); v1 = 5000;}
if(Th >= 5999 && Th <=7000){LcdStr(1, "6"); v1 = 6000;}
if(Th >= 6999 && Th <=8000){LcdStr(1, "7"); v1 = 7000;}
if(Th >= 7999 && Th <=9000){LcdStr(1, "8"); v1 = 8000;}
if(Th >= 8999 && Th <=10000){LcdStr(1, "9"); v1 = 9000;}

int Hu; // create temp variable Hu (Hundreds)
int v2; // create variable v2
Hu = (Th -= v1); // get rid of the thousends
if(Hu >= 0 && Hu <= 100){LcdStr(1, "0");v2 = 0;}
if(Hu >= 99 && Hu <=200){LcdStr(1, "1");v2 = 100;}
if(Hu >= 199 && Hu <=300){LcdStr(1, "2");v2 = 200;}
if(Hu >= 299 && Hu <=400){LcdStr(1, "3");v2 = 300;}
if(Hu >= 399 && Hu <=500){LcdStr(1, "4"); v2 = 400;}
if(Hu >= 499 && Hu <=600){LcdStr(1, "5"); v2 = 500;}
if(Hu >= 599 && Hu <=700){LcdStr(1, "6"); v2 = 600;}
if(Hu >= 699 && Hu <=800){LcdStr(1, "7"); v2 = 700;}
if(Hu >= 799 && Hu <=900){LcdStr(1, "8"); v2 = 800;}
if(Hu >= 899 && Hu <=1000){LcdStr(1, "9"); v2 = 900;}
int Te;

Te = (Hu -= v2); // get rid of the hundreds
int v3;
if(Te >= 0 && Te <=10){LcdStr(1, "0");v3 = 0;}
if(Te >= 9 && Te <=20){LcdStr(1, "1"); v3 = 10;}
if(Te >= 19 && Te <=30){LcdStr(1, "2"); v3 = 20;}
if(Te >= 29 && Te <=40){LcdStr(1, "3"); v3 = 30;}
if(Te >= 39 && Te <=50){LcdStr(1, "4"); v3 = 40;}
if(Te >= 49 && Te <=60){LcdStr(1, "5"); v3 = 50;}
if(Te >= 59 && Te <=70){LcdStr(1, "6"); v3 = 60;}
if(Te >= 69 && Te <=80){LcdStr(1, "7"); v3 = 70;}
if(Te >= 79 && Te <=90){LcdStr(1, "8"); v3 = 80;}
if(Te >= 89 && Te <=100){LcdStr(1, "9"); v3 = 90;}

LcdUpdate(); // call up Print subroutine

I don't know what LCD code you are using, but if you use the built-in (as of Arduino 0012) LiquidCrystal library, you can simply use lcd.print().

Mikal