Pages: 1 [2]   Go Down
Author Topic: LCD shield menu  (Read 2525 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Full Member
***
Karma: 1
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, this is the same idea as above.
I just suggested a solution that uses this linear correlation I mentioned. How to finally implement the feature is left to the author.
Logged

using Arduino Uno Rev 3

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I am sorry for my absence.
Thanks everyone for help with menu.
I need this menu to bulid  steering of kettle. I want to measure temperature and activate pump. I try to do this in code below. I use sensor DS18B20 and LED on pin 52. In egz wen temp is over 25deg pin 52 is high. I cant place this part of code to void loop because is generate error: tempC is not declared in this scope. When I place it into void setup is working good.
What I do wrong?

Thank you for help.


code:
   
Code:
if (tempC >= 25.00)
    {
     digitalWrite(52, HIGH);
    }
    else
    {
      digitalWrite(52, LOW);
    }


code:
Code:
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #include <LiquidCrystal.h>
    #define ONE_WIRE_BUS 22

    LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    DeviceAddress insideThermometer = { 0x28, 0x26, 0x44, 0xBB, 0x03, 0x00, 0x00, 0x0D };




    void setup(void)
    {
      Serial.begin(9600);
      pinMode(52, OUTPUT);
      sensors.begin();
      sensors.setResolution(insideThermometer, 10);
      lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
      lcd.clear(); // start with a blank screen
    }
      void printTemperature(DeviceAddress deviceAddress)
    {
      float tempC = sensors.getTempC(deviceAddress);
      if (tempC == -127.00) {
      lcd.print("Error");
    }
      else {
      lcd.print(tempC);
    }
    }


    void loop(void)
    {
      delay(2000);
      sensors.requestTemperatures();
      lcd.setCursor(0,0);
      lcd.print("kociol: ");
      printTemperature(insideThermometer);
      lcd.write(0xDF);
      lcd.write('C');
    }





Logged

Germany
Offline Offline
Full Member
***
Karma: 1
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't see a "tempC" in your loop.
You could also initiate  (e.g. declare)  this var at the very beginning after havign defined the classes instances 
Logged

using Arduino Uno Rev 3

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't see tempC in loop because when i declare:
float tempC;
   if (tempC >= 25.00)
    {
     digitalWrite(52, HIGH);
    }
    else
    {
      digitalWrite(52, LOW);
    }
and I print tempC on serial i recive value: 0.00
On lcd I have good temperature.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49343
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You don't see tempC in loop because when i declare:
float tempC;
   if (tempC >= 25.00)
    {
     digitalWrite(52, HIGH);
    }
    else
    {
      digitalWrite(52, LOW);
    }
and I print tempC on serial i recive value: 0.00
When I declare a variable, but don't give it a value, I get zero. Why is that?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Pauls,
I was declared a tempC like this on the begining:
Code:
volatile float tempC;
It was help.
Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As far as the buttons go, there is a LCDKeypad library for that shield that handles the buttons too.

For your menu, try the MENWIZ library
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I actually have an additional question based on the LCD display for the arduino.
I want to have it set up to where you press two buttons at the same time and then continue in the if statement. But because the buttons are read with analog pins I am unsure as to what value I should make the conditional for two buttons, but only a single button. If anybody has any idea, please let me know!
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49343
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If anybody has any idea, please let me know!
Write a sample sketch. Print the analogRead() value for one switch at a time, for two switches at a time, etc.
Logged

Pages: 1 [2]   Go Up
Jump to: