#!/usr/bin/env python
import time
import RPi.GPIO as GPIO
import LiquidCrystalPi
from w1thermsensor import W1ThermSensor
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
LCD = LiquidCrystalPi.LCD(11, 12, 15, 16, 18, 22)
LCD.begin(16,2)
LCD.nextline()
sensor = W1ThermSensor()
while True:
temperature = sensor.get_temperature()
print("The temperature is %s celsius" % temperature)
time.sleep(1)
LCD.write(" ")
LCD.write(str(temperature))
LCD.write(" *C")
time.sleep(2)
Comments