def cleanup(self): self.logger.debug("PlayingState cleaned up") self._random_msg_display.stop() self._name_display.stop() self._title_display.stop() if __name__ == "__main__": # Resourcecs initialization rsc = Resources("/home/pi/python/webradio/conf.txt") # lcd initialization lcd = CharLCD(i2c_expander='PCF8574', address=0x3f, port=1, cols=20, rows=4, dotsize=8, charmap='A02', auto_linebreaks=True, backlight_enabled=True) lcd.backlight_enabled = True wifi = (0b00000, 0b11111, 0b00000, 0b01110, 0b00000, 0b00100, 0b00100, 0b00000) lcd.create_char(0, wifi) state = PlayingState(lcd, rsc) state.enter_state() input("Entree pour quitter...") lcd.backlight_enabled = False
auto_linebreaks=False) else: from RPLCD.gpio import CharLCD lcd = CharLCD(cols=cols, rows=rows, charmap=charmap, numbering_mode=GPIO.BOARD, pin_rs=15, pin_rw=18, pin_e=16, pins_data=[21, 22, 23, 24], auto_linebreaks=False) argv1 = sys.argv[1] # backlight on/off if argv1 == 'on' or argv1 == 'off': lcd.backlight_enabled = argv1 == 'on' and True or False quit() pause = ( 0b00000, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b00000, 0b00000, ) play = ( 0b10000, 0b11000,
#!/usr/bin/env python3 import time from RPLCD.i2c import CharLCD import sys #NOTE: 0x27 may be different on your screen, refer to https://rplcd.readthedocs.io/ lcd = CharLCD('PCF8574', 0x27) lcd.backlight_enabled = True def main(): time.sleep(0.05) # this sleep ensures no funny business with the restart lcd.clear() lcd.write_string("Input code\n\ron host...") foo = input("Input today\'s code: ") lcd.clear() lcd.write_string(foo) time.sleep(60) lcd.clear() t = 5 while t > 0: lcd.clear() lcd.write_string("LCD_timeout" + "\n\r" + "Timeout: " + str(t)) t -= 1 time.sleep(1) while True: if __name__ == "__main__": try: