diff options
| author | D Delmar Davis <don@suspectdevices.com> | 2025-01-31 22:35:43 -0800 |
|---|---|---|
| committer | D Delmar Davis <don@suspectdevices.com> | 2025-01-31 22:35:43 -0800 |
| commit | 60819bbd0d550769153ba2545e055e28342cea32 (patch) | |
| tree | 11cc98f75086e08786423bad948d2564c1c383ca | |
| parent | a15d74ee642721d44329190eec655a66eac460ad (diff) | |
try this
| -rwxr-xr-x | bin/lcdtemp.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/bin/lcdtemp.py b/bin/lcdtemp.py index 5d9d271..7fd3e55 100755 --- a/bin/lcdtemp.py +++ b/bin/lcdtemp.py @@ -6,10 +6,21 @@ import time import board import adafruit_character_lcd.character_lcd_i2c as character_lcd +import subprocess + +cmd = "hostname -I | cut -d' ' -f1" +IP = subprocess.check_output(cmd, shell=True).decode("utf-8") +cmd = "date +%X\ %d%b%y" +TimeDate = subprocess.check_output(cmd, shell=True).decode("utf-8") +cmd = "fetchtemp.py" +LocalTemp = subprocess.check_output(cmd, shell=True).decode("utf-8") +cmd = 'gathertemps.py' +PromData = subprocess.check_output(cmd, shell=True).decode("utf-8") +temps=PromData.split() # Modify this if you have a different sized Character LCD -lcd_columns = 16 -lcd_rows = 2 +lcd_columns = 20 +lcd_rows = 4 # Initialise I2C bus. i2c = board.I2C() # uses board.SCL and board.SDA @@ -21,38 +32,28 @@ lcd = character_lcd.Character_LCD_I2C(i2c, lcd_columns, lcd_rows) # Turn backlight on lcd.backlight = True # Print a two line message -lcd.message = "Hello\nCircuitPython" +lcd.message = CMD + IP # Wait 5s time.sleep(5) lcd.clear() # Print two line message right to left lcd.text_direction = lcd.RIGHT_TO_LEFT -lcd.message = "Hello\nCircuitPython" +lcd.message = TimeDate # Wait 5s time.sleep(5) -# Return text direction to left to right -lcd.text_direction = lcd.LEFT_TO_RIGHT -# Display cursor lcd.clear() lcd.cursor = True -lcd.message = "Cursor! " +lcd.message = temps # Wait 5s time.sleep(5) # Display blinking cursor lcd.clear() lcd.blink = True -lcd.message = "Blinky Cursor!" +lcd.message = PromData # Wait 5s time.sleep(5) lcd.blink = False lcd.clear() -# Create message to scroll -scroll_msg = "<-- Scroll" -lcd.message = scroll_msg -# Scroll message to the left -for i in range(len(scroll_msg)): - time.sleep(0.5) - lcd.move_left() lcd.clear() lcd.message = "Going to sleep\nCya later!" time.sleep(5) |
