diff --git a/displaytest.py b/displaytest.py index 19f6622..88fe906 100644 --- a/displaytest.py +++ b/displaytest.py @@ -22,6 +22,20 @@ serial = spi(device=0, port=0, bus_speed_hz = 8000000, transfer_size = 4096, gpi device = sh1106(serial, rotate=2) #sh1106 oled_font = ImageFont.load_default() -with canvas(device) as draw: - draw.rectangle(device.bounding_box, outline = "white", fill = "black") - draw.text((10, 10), "OLED-Display", font = oled_font, fill = "white") \ No newline at end of file + +def main() + with canvas(device) as draw: + draw.rectangle(device.bounding_box, outline = "white", fill = "black") + draw.text((10, 10), "OLED-Display", font = oled_font, fill = "white") + + +try: + while True: + stamp = time.time() + main() + time.sleep(1) + +except: + print("Stopped", sys.exc_info()[0]) + raise +GPIO.cleanup() \ No newline at end of file