DS18B20 and LCD display

This DS18B20 example we output the temperature to our LCD display. The LCD display we use is the LCD Keypad Shield that is available for sale from various sources.

Here is the temperature displayed on the LCD, as you can see its a shield that can be fitted to your Arduino Uno. Links at the bottom of the article

lcd temperature display

Code
[c]
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>

//DS18b20 connected to D13
#define DS18B20 13
// Connections: Sainsmart LCD/Keypad shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
OneWire ourWire(DS18B20);
DallasTemperature sensors(&ourWire);

void setup()
{
//Serial.begin(9600);
delay(1000);
//start reading
sensors.begin();
//setup the LCD
lcd.begin(16, 2); // start the library
lcd.setCursor(0,0);
lcd.print(“TEMPERATURE”);
}

void loop()
{
//read temperature and output via LCD
sensors.requestTemperatures();
lcd.setCursor(0,1);
lcd.print(sensors.getTempCByIndex(0));
lcd.setCursor(6,1);
lcd.print(“celsius”);
}
[/c]
Links

 

LCD and Keypad Shield on Amazon US

LCD and keypad shield on Amazon UK

Related posts

Arduino and 4051 LED example

Interfacing to a 24LC256 EEPROM

Arduino and MCP23017 example

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More