diff --git a/rpi/lcd-screen/main.py b/rpi/lcd-screen/main.py index e3ee4b75..33b6158a 100644 --- a/rpi/lcd-screen/main.py +++ b/rpi/lcd-screen/main.py @@ -1,5 +1,6 @@ -#import lcd -import time +from grove_rgb_lcd import * +import sys +import select whiteTime = 5 * 60 blackTime = 5 * 60 @@ -18,21 +19,21 @@ def update_timer(white_total_time, black_total_time): black_minutes = compute_minutes(black_total_time) black_seconds = compute_seconds(black_total_time) - print(f"W {white_minutes:02d}:{white_seconds:02d} || B {black_minutes:02d}:{black_seconds:02d}") - #lcd.setText(f"W {white_minutes:02d}:{white_seconds:02d} || B {black_minutes:02d}:{black_seconds:02d}") + setText(f"W {white_minutes:02d}:{white_seconds:02d} || B {black_minutes:02d}:{black_seconds:02d}") if __name__ == "__main__": - + setRGB(255, 255, 255) while whiteTime > 0 and blackTime > 0: currentTime = 0 if current == "white": - current = "black" whiteTime -= 1 else: - current = "white" blackTime -= 1 update_timer(whiteTime, blackTime) - time.sleep(1) - #lcd.setText("Time up!") \ No newline at end of file + rlist, _, _ = select.select([sys.stdin], [], [], 1) + + if rlist: + sys.stdin.readline() # consume Enter + current = "black" if current == "white" else "white"