LCD works
This commit is contained in:
parent
ef66e0cfd6
commit
65111340cf
1 changed files with 11 additions and 9 deletions
20
gbmanager.py
20
gbmanager.py
|
@ -2,9 +2,9 @@ from machine import Pin, I2C
|
|||
from onewire import OneWire
|
||||
from ds18x20 import DS18X20
|
||||
from time import sleep_ms
|
||||
#from machine_i2c_lcd import I2cLcd
|
||||
from machine_i2c_lcd import I2cLcd
|
||||
from lcd_api import LcdApi
|
||||
from i2c_lcd import I2cLcd
|
||||
#from pico_i2c_lcd import I2cLcd
|
||||
|
||||
# Relais
|
||||
relais = Pin(15, machine.Pin.OUT, value = 1)
|
||||
|
@ -19,12 +19,14 @@ sensor_id = temp_sensor.scan()[0]
|
|||
#lcd = I2cLcd(i2c, 0x27, 2, 16)
|
||||
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
|
||||
lcd_addr = 39
|
||||
i2c.writeto(lcd_addr, '\x7C')
|
||||
i2c.writeto(lcd_addr, '\x2D')
|
||||
I2C_ADDR = 0x27
|
||||
I2C_NUM_ROWS = 2
|
||||
I2C_NUM_COLS = 16
|
||||
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
|
||||
|
||||
# Text in Zeilen
|
||||
line_top = 'Temp. (Soll):'
|
||||
line_bot = 'Temp. (Ist) :'
|
||||
line_top = 'Soll: '
|
||||
line_bot = 'Ist : '
|
||||
|
||||
def ctrl_relais(active = True):
|
||||
if active:
|
||||
|
@ -38,9 +40,9 @@ def ctrl_relais(active = True):
|
|||
while True:
|
||||
temp_sensor.convert_temp()
|
||||
sleep_ms(750)
|
||||
print(temp_sensor.read_temp(sensor_id), " °C")
|
||||
#i2c.writeto(lcd_addr, line_top + "\n" + line_bot)
|
||||
i2c.writeto(lcd_addr, "Hello world")
|
||||
temp_curr = str(temp_sensor.read_temp(sensor_id))
|
||||
lcd.move_to(0, 0)
|
||||
lcd.putstr(line_top + "\n" + line_bot + temp_curr + " °C")
|
||||
sleep_ms(2000)
|
||||
|
||||
#ctrl_relais(True)
|
||||
|
|
Loading…
Reference in a new issue