Mar-12-2018, 02:04 AM
(Mar-12-2018, 01:41 AM)Larz60+ Wrote: please show your code, use BBCODE tags
#!/usr/bin/python # Example using a character LCD connected to a Raspberry Pi or BeagleBone Black. import time import Adafruit_CharLCD as LCD # Raspberry Pi pin configuration: lcd_rs = 25 # Note this might need to be changed to 21 for older revision Pi's. lcd_en = 24 lcd_d4 = 8 lcd_d5 = 7 lcd_d6 = 12 lcd_d7 = 16 lcd_backlight = 2 outdoor="/sys/bus/w1/devices/28-0517b184cdff/w1_slave" indoor="/sys/bus/w1/devices/28-0517b196efff/w1_slave" # Define LCD column and row size for 16x2 LCD. lcd_columns = 16 lcd_rows = 2 # Alternatively specify a 20x4 LCD. # lcd_columns = 20 # lcd_rows = 4 # Initialize the LCD using the pins above. lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight) while True: with open(outdoor) as odt: odt_contents = odt.read() odt_temp = odt_contents[69:75] temp_outdoor = int(float(odt_temp)) outdoortemp = temp_outdoor / 1000 * 9 / 5 + 32 with open(indoor) as idt: idt_contents = idt.read() idt_temp = idt_contents[69:75] temp_indoor = int(float(idt_temp)) indoortemp = temp_indoor / 1000 * 9 / 5 + 32 # Print a two line message lcd.clear() lcd.message("") # Wait 5 seconds time.sleep(5.0)Where lcd.message("") is I would like it to print:
Indoor: (indoortemp)
and one line 2
Outdoor: (outdoortemp)
Basically print text and then the variable.