Commit 2cfb0f47 authored by Piotr "PHT" Jasiek's avatar Piotr "PHT" Jasiek

Addition of LCD support compatible with HD44780

parent 5dd1283c
#!/usr/bin/python
import sys
import time
import datetime
from RPLCD.gpio import *
from modules.database import *
GPIO.setwarnings(False)
lcd = CharLCD(cols=20, rows=4, pin_rs=27, pin_e=22, pins_data=[14, 15, 18, 23], numbering_mode=GPIO.BCM)
while True:
outside_temp = get_prev_value('outside_temp')
outside_hum = get_prev_value('outside_hum')
outside_pressure = get_prev_value('outside_pressure')
inside_temp = get_prev_value('inside_temp')
inside_hum = get_prev_value('inside_hum')
greenhouse_temp = get_prev_value('greenhouse_temp')
greenhouse_hum = get_prev_value('greenhouse_hum')
now = datetime.datetime.now()
greenhouse_pressure = get_prev_value('greenhouse_pressure')
outside_line = ('%s*C %s%% %s') % (outside_temp, outside_hum, outside_pressure)
inside_line = ('%s*C %s%%') % (inside_temp, inside_hum)
greenhouse_line = ('%s*C %s%% %s') % (greenhouse_temp, greenhouse_hum, greenhouse_pressure)
lcd.clear()
lcd.cursor_pos = (0, 0)
lcd.write_string(now.strftime("%H:%M:%S %Y-%m-%d"))
lcd.cursor_pos = (1, 0)
lcd.write_string(outside_line)
lcd.cursor_pos = (2, 0)
lcd.write_string(inside_line)
lcd.cursor_pos = (3, 0)
lcd.write_string(greenhouse_line)
time.sleep(10)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment