diff --git a/GPIO-demo.py b/GPIO-demo.py index ea12611..9e937f6 100644 --- a/GPIO-demo.py +++ b/GPIO-demo.py @@ -1,10 +1,15 @@ ''' - Demo Python GPIO on the MQ-Pro (requires a modified device tree) - See: https://github.com/easytarget/MQ-Pro-IO/ - For install requirements requirements look at: - - https://github.com/easytarget/MQ-Pro-IO/blob/main/GPIO-examples.md#python-demo + Demo Python GPIO on the MQ-Pro (requires a modified device tree) + See: https://github.com/easytarget/MQ-Pro-IO/ + + For install requirements requirements look at: + - https://github.com/easytarget/MQ-Pro-IO/blob/main/GPIO-examples.md#python-demo + Tested using the LoRa HAT device tree: + - https://github.com/easytarget/MQ-Pro-IO/tree/main/alt-trees/lora-hat ''' -from time import sleep + +from time import sleep, ctime + # oled libs from luma.core.interface.serial import i2c from luma.core.render import canvas @@ -31,9 +36,9 @@ while True: t = round(bme280.get_temperature(),1) h = round(bme280.get_humidity(),1) p = round(bme280.get_pressure()) - out = ' Temp: {}°\n Humi: {}%\n Pres: {}mb'.format(t,h,p) + out = ' Temp: {}°C\n Humi: {}%\n Pres: {}mb'.format(t,h,p) with canvas(device) as draw: draw.rectangle(device.bounding_box, outline="white", fill="black") draw.text((26, 12), out, fill="white") - print(out.replace('\n',' : ')) + print('{} : {}°C, {}%, {}mb'.format(ctime(),t,h,p) sleep(1)