def lcdPrint(text, line): if line==1: lib_lcd.lcd_string(text,lib_lcd.LCD_LINE_1) else: lib_lcd.lcd_string(text,lib_lcd.LCD_LINE_2)
def lcdPrint(text, line): if line == 1: lib_lcd.lcd_string(text, lib_lcd.LCD_LINE_1) else: lib_lcd.lcd_string(text, lib_lcd.LCD_LINE_2)
current_mode = 0 # a more convenient way of printing text to LCD def lcdPrint(text, line): if line==1: lib_lcd.lcd_string(text,lib_lcd.LCD_LINE_1) else: lib_lcd.lcd_string(text,lib_lcd.LCD_LINE_2) def main(): GPIO.add_event_detect(17, GPIO.RISING, callback=changeMode, bouncetime=300) lcdPrint("LightHub", 1) lcdPrint("Initialized", 2) while True: pass if __name__ == '__main__': try: main() except KeyboardInterrupt: pass finally: lib_lcd.lcd_byte(0x01, lib_lcd.LCD_CMD) lib_lcd.lcd_string("Goodbye!",lib_lcd.LCD_LINE_1) GPIO.cleanup()
# a more convenient way of printing text to LCD def lcdPrint(text, line): if line == 1: lib_lcd.lcd_string(text, lib_lcd.LCD_LINE_1) else: lib_lcd.lcd_string(text, lib_lcd.LCD_LINE_2) def main(): GPIO.add_event_detect(17, GPIO.RISING, callback=changeMode, bouncetime=300) lcdPrint("LightHub", 1) lcdPrint("Initialized", 2) while True: pass if __name__ == '__main__': try: main() except KeyboardInterrupt: pass finally: lib_lcd.lcd_byte(0x01, lib_lcd.LCD_CMD) lib_lcd.lcd_string("Goodbye!", lib_lcd.LCD_LINE_1) GPIO.cleanup()