Skip to content

Instantly share code, notes, and snippets.

@bjoernhohe
Created May 12, 2019 08:40
Show Gist options
  • Save bjoernhohe/691b35030bcc0c0b8f292828941438fa to your computer and use it in GitHub Desktop.
Save bjoernhohe/691b35030bcc0c0b8f292828941438fa to your computer and use it in GitHub Desktop.
import sys
import time
import Adafruit_DHT
from RPLCD.i2c import CharLCD
sensor = Adafruit_DHT.DHT11
pin = 4
lcd = CharLCD('PCF8574', 0x27)
while True:
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
lcd.cursor_pos = (0, 0)
lcd.write_string("Temp: %d C" % temperature)
lcd.cursor_pos = (1, 0)
lcd.write_string("Humidity: %d %%" % humidity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment