16 x 2 display Help


hello,
i working on sketch display humidity , temp on 16 x 2 display. second sketch display. verified code , fixed errors made. humidity being displayed on bottom line instead of top , temp not show @ all. here code:

code: [select]
// sketch dht11 humidity/temperature sensor lcd
// written ladyada, public domain
// modified bean

#include "dht.h"

#define dhtpin 2     // dhtpin pin 2

#define dhttype dht11   // dht 11

// connect pin 1 (on left) of sensor +5v
// connect pin 2 of sensor whatever dhtpin is
// connect pin 4 (on right) of sensor ground
// connect 10k resistor pin 2 (data) pin 1 (power) of sensor

dht dht(dhtpin, dhttype);

#include <liquidcrystal.h>

liquidcrystal lcd (7, 8, 9, 10, 11, 12);

// lcd rs pin digital pin 7
// lcd enable digital pin 8
// lcd d4 digital pin 9
// lcd d5 digital pin 10
// lcd d6 digital pin 11
// lcd d7 digital pin 12
// lcd r/w pin ground
// lcd 15 5 volts 220 ohm resistor , lcd 2 5 volts
// lcd 16 , 1 ground
// lcd 3 wiper on trimmer pot

void setup() {
  lcd.begin(16, 2);


  dht.begin();
}

void loop() {
  // reading temperature , humidity
  float h = dht.readhumidity();
  float t = dht.readtemperature();
  t = (t*1.8)+32; //c f conversion
 
  // set cursor column 0, line 1
  lcd.setcursor(0, 1);

  // check if returns valid
  if (isnan(t) || isnan(h)) {
    lcd.print("failed read dht");
  } else {
    lcd.print("humidity: ");
    lcd.print(h);
    lcd.print(" %\t");
    lcd.print("temperature: ");
    lcd.print(t);
    lcd.print(" *f");
  }
}


i missing can not figure out what. appreciated!! thanks

code: [select]
lcd.setcursor(0, 1);
sets cursor second line.  lines numbered 0. 
you need setcursor(0,0) first line , setcursor(0,1) display temperature.


Arduino Forum > Using Arduino > Displays > 16 x 2 display Help


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support