Go Down

Topic: LCD Thermostat (Read 1 time) previous topic - next topic

Nitro_boy

Hi all !!

I'm very new to lcd codes and i've made a simple thermostat but now i have a problem that I don't know how to make a menu on my LCD.
The menu should have two items so that I can manualy turn two outputs ON and OFF, with 2 buttons ( forward, select) to get to the menu I vould press both buttons.
Can you help me ?
Code: [Select]
#include <LiquidCrystal.h>
 int  ledPin = 8;
 int  TEMPTRIGGER = 25.00;
 float temperature = 0;
 LiquidCrystal lcd(10, 11, 12, 13, 14, 15, 16);

void setup()
{

 pinMode(ledPin, OUTPUT);
 lcd.begin(16, 2);
 lcd.setCursor(0,0);
 lcd.print("Made By Elvis K.");

 lcd.setCursor(0,1);
 lcd.print("Prosim pocakaj...");
 delay(2000);
 lcd.clear(); // clear LCD screen
 lcd.setCursor(0,0);
 lcd.print("Temperatura je: ");
}

void loop()
{
 if(temperature >= TEMPTRIGGER) {
   digitalWrite( ledPin, HIGH);
   delay(100);
   digitalWrite( ledPin, LOW);
   delay(100);
   lcd.setCursor(0,0);
   lcd.print("  ALARM ALARM  ");
   }
     else{
       digitalWrite( ledPin, LOW);
       lcd.setCursor(0,0);
       lcd.print("Temperatura je: ");
   }

 temperature = analogRead(5); /
 temperature = temperature +252-500;
 temperature = temperature / 10;

 delay (100);
   lcd.print(" Temperature is   ");
   lcd.setCursor(0,1);
   lcd.print(temperature);
   lcd.println(" stop. C.   ");
 delay(500);
}


Thanks !

johnwasser

Some things to do:

You'll need to keep track of what state the display is in.  If you are displaying a menu you don't want to also be displaying the temperature.

When you are not displaying the menu you should ignore a button being pressed unless both buttons are pressed.

When you are displaying a menu you should ignore a button being pressed if it was already pressed the last time you checked or if the other button is already pressed.

You want to somehow highlight the selected line, perhaps with a ">" in the left column.  When the "next" button is pressed you want to move the pointer.  When the "select" button is pressed you want to perform the selected action and go back to displaying the temperature.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Nitro_boy

that is exactly what i'm trying to do, but I don't know how :D

Nitro_boy


Nitro_boy

I found this but don't know how  to implant it in to my code.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1273349195/45

Is there really nobody that wants to help me ?

rolandoo

Hello

Did you find solution for a problem to make a menu on LCD?

I have the same problem, can you help me?

Thank you in advace



Go Up