Pages: [1]   Go Down
Author Topic: LCD Thermostat  (Read 1644 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 38
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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 !
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Newbie
*
Karma: 0
Posts: 38
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

that is exactly what i'm trying to do, but I don't know how smiley-grin
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 38
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No one to help ?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 38
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: