def __init__(self, rail, config=None): lcd.clear() bl.off() Displayotron.rail = rail self.config = config if config['use_rbg']: bl.use_rbg()
def signal_handler(signal, frame): global is_active is_active = False backlight.set_graph(0) lcd.clear() backlight.off() exit(0)
def handle_button(pin): global ButtonStatus global loopcount if ButtonStatus == 'On': backlight.off() ButtonStatus = 'Off' else: loopcount = 0 backlight.rgb(229, 0, 255) ButtonStatus = 'On'
def idle(): #if debug: print "Start idle function." backlight.off() lcd.set_cursor_position(0,0) lcd.write(txt_security) lcd.set_cursor_position(4,1) t = datetime.now().strftime("%H:%M:%S") lcd.write(t) lcd.set_cursor_position(0,2) lcd.write(txt_pressme) time.sleep(0.5)
#!/usr/bin/env python import dot3k.lcd as lcd import dot3k.backlight as backlight backlight.use_rbg() backlight.off() lcd.clear()
def screenOff(): global screen_on backlight.off() lcd.clear() screen_on = False
def cleanUp(sig, frame): backlight.off() lcd.clear() print("Exiting kubernetes status server") sys.exit(0)
@joystick.on(joystick.BUTTON) def handle_up(pin): emit_event('Joystick', 'button') while True: data = json.loads(raw_input()) component = data['component'] command = data['command'] parameters = data['parameters'] if component == 'DisplayOTron': if command == 'kill': if parameters['performReset']: lcd.clear() backlight.off() backlight.set_graph(0.0) sys.exit() elif command == 'reset': lcd.clear() backlight.off() backlight.set_graph(0.0) elif component == 'LCD': if command == 'clear': lcd.clear() elif command == 'setContrast': lcd.set_contrast(parameters['contrast']) elif command == 'setCursorPosition': lcd.set_cursor_position(parameters['column'], parameters['row']) elif command == 'write':
def end(self): self.printIt(""," fin .","") backlight.off()
def signal_handler(signal, frame): lcd.clear() backlight.off() sys.exit(0)
def on_event(self, event, payload): if event in "Connected": lcd.clear() lcd.write('Connected to:') lcd.set_cursor_position(0, 1) lcd.write(payload["port"]) if event in "Shutdown": lcd.clear() lcd.write('Bye bye ^_^') time.sleep(1) backlight.off() backlight.update() lcd.exit() if event in "PrinterStateChanged": if payload["state_string"] in "Offline": lcd.clear() lcd.write('Octoprint is not connected') time.sleep(2) lcd.clear() lcd.write('saving a polar bear, eco mode ON') time.sleep(5) backlight.off() backlight.update() if payload["state_string"] in "Operational": backlight.rgb(255, 255, 255) backlight.update() lcd.clear() lcd.write('Printer is Operational') if payload["state_string"] in "Cancelling": backlight.rgb(255, 0, 255) backlight.update() lcd.clear() lcd.write('Printer is Cancelling job') time.sleep(0.2) if payload["state_string"] in "PrintCancelled": lcd.clear() backlight.rgb(255, 0, 0) backlight.update() time.sleep(0.5) lcd.write(' Job has been Cancelled (0_0) ') time.sleep(2) if payload["state_string"] in "Paused": backlight.rgb(255, 0, 255) backlight.update() lcd.clear() time.sleep(0.5) lcd.write('Printer is Paused') if payload["state_string"] in "Resuming": backlight.rgb(0, 255, 255) backlight.update() lcd.clear() lcd.write('Printer is Resuming its job') time.sleep(0.2)
def power_off(self): backlight.off()