def right(self): v_module = self.modules[self.selected_module] isRunning = self.getModuleStatus(self.modules[self.selected_module]) if isRunning == "Y": # module is running, stop it execute = "/module/" + v_module + "/stop" self.consoleMessages.show_info("Stoping module: " + str(v_module) + "") else: # module is not running, start it execute = "/module/" + v_module + "/start" self.consoleMessages.show_info("Starting module: " + str(v_module) + "") backlight.set_bar(0, 20) result = self.webclient.call_api(execute) # fire up bargraph leds! Wohoo for i in range(100): backlight.set_graph(i / 70.0) time.sleep(0.005) # disable leds =( backlight.set_graph(0) self.ready = True try: if result[0] == True: return "Y" else: return "N" except: return "E"
def loadingScreen(): lcd.clear() # set brigthness backlight.set_bar(0, 20) # write loading message to lcd lcd.set_cursor_position(3,1) lcd.write("Loading...") # fire up bargraph leds! Wohoo for i in range(100): backlight.set_graph(i / 70.0) time.sleep(0.005) # disable leds =( backlight.set_graph(0)
def ledNodes(): global nodesList #shutdown all LEDs for x in range(0, 9): backlight.set_bar(x, 0) time.sleep(0.05) threading.Timer(5.0, ledNodes).start() if len(nodesList) <= 0: for x in range(0, 9): backlight.set_bar(x, 100) else: for x in range(0, len(nodesList)): backlight.set_bar(x, 255)
#!/usr/bin/env python import dot3k.lcd as lcd import dot3k.backlight as backlight import time # Clear the LCD and display Hello World lcd.clear() lcd.write("Hello World") # Turn off the backlight backlight.rgb(0,0,0) """ set_graph accepts a float between 0.0 and 1.0 and lights up the LEDs accordingly """ for i in range(100): backlight.set_graph(i/100.0) time.sleep(0.05) """ set_bar will set a specific bargraph LED to a brightness between 0 and 255 """ for i in range(256): backlight.set_bar(0,[255-i]*9) time.sleep(0.01) backlight.set_graph(0)
backlight.use_rbg() elif command == 'setBrightnessOfLed': backlight.set(parameters['ledIndex'], parameters['brightness']) elif command == 'setToHue': backlight.hue(parameters['hue']) elif command == 'setLeftToHue': backlight.left_hue(parameters['hue']) elif command == 'setMiddleToHue': backlight.mid_hue(parameters['hue']) elif command == 'setRightToHue': backlight.right_hue(parameters['hue']) elif command == 'setToRGB': backlight.rgb(parameters['red'], parameters['green'], parameters['blue']) elif command == 'setLeftToRGB': backlight.left_rgb(parameters['red'], parameters['green'], parameters['blue']) elif command == 'setMiddleToRGB': backlight.mid_rgb(parameters['red'], parameters['green'], parameters['blue']) elif command == 'setRightToRGB': backlight.right_rgb(parameters['red'], parameters['green'], parameters['blue']) elif component == 'BarGraph': if command == 'turnOff': backlight.set_graph(0.0) elif command == 'setByPercentage': backlight.set_graph(float(parameters['percentage']) / 100) elif command == 'setBrightnessOfLed': backlight.set_bar(parameters['ledIndex'], parameters['brightness'])
lcd.write(outputeth) lcd.set_cursor_position(0, 2) if wlxinterface != 'Disconnected': outputwlan = ('W:' + wlxinterface) outputwlan = outputwlan + (16 - len(outputwlan)) * ' ' lcd.write(outputwlan) else: outputwlan = ('W:{}'.format(wlxinterface)) outputwlan = outputwlan + (16 - len(outputwlan)) * ' ' lcd.write(outputwlan) #Sets the bar LED lights to a percentage of cputemp to the thermal throttle 80 degrees CpuTemp = getCPUtemperature() backlight.set_bar(0, [155] * int(float(CpuTemp) / 80 * 10)) # Puts the display to sleep after a minute the button press turns it on again if loopcount == 60: while loopcount >= 60: lcd.clear() backlight.off() time.sleep(1) loopcount = loopcount + 1 time.sleep(1) # lcd.set_cursor_position(0,1) # CPUUse = getCPUuse() # CPUUse = CPUUse + (16 - len(CPUUse)) * ' ' # lcd.write(CPUUse)
elif component == 'Backlight': if command == 'turnOff': backlight.off() elif command == 'useRBGMode': backlight.use_rbg() elif command == 'setBrightnessOfLed': backlight.set(parameters['ledIndex'], parameters['brightness']) elif command == 'setToHue': backlight.hue(parameters['hue']) elif command == 'setLeftToHue': backlight.left_hue(parameters['hue']) elif command == 'setMiddleToHue': backlight.mid_hue(parameters['hue']) elif command == 'setRightToHue': backlight.right_hue(parameters['hue']) elif command == 'setToRGB': backlight.rgb(parameters['red'], parameters['green'], parameters['blue']) elif command == 'setLeftToRGB': backlight.left_rgb(parameters['red'], parameters['green'], parameters['blue']) elif command == 'setMiddleToRGB': backlight.mid_rgb(parameters['red'], parameters['green'], parameters['blue']) elif command == 'setRightToRGB': backlight.right_rgb(parameters['red'], parameters['green'], parameters['blue']) elif component == 'BarGraph': if command == 'turnOff': backlight.set_graph(0.0) elif command == 'setByPercentage': backlight.set_graph(float(parameters['percentage']) / 100) elif command == 'setBrightnessOfLed': backlight.set_bar(parameters['ledIndex'], parameters['brightness'])
#!/usr/bin/env python import dot3k.lcd as lcd import dot3k.backlight as backlight import time # Clear the LCD and display Hello World lcd.clear() lcd.write("Hello World") # Turn off the backlight backlight.rgb(0, 0, 0) """ set_graph accepts a float between 0.0 and 1.0 and lights up the LEDs accordingly """ for i in range(100): backlight.set_graph(i / 100.0) time.sleep(0.05) """ set_bar will set a specific bargraph LED to a brightness between 0 and 255 """ for i in range(256): backlight.set_bar(0, [255 - i] * 9) time.sleep(0.01) backlight.set_graph(0)