arm1 = list(binhour) elif armtop == "m": arm1 = list(binmin) else: arm1 = list(binsec) led01 = ledbrightness if arm1[5] == "1" else 0 pyglow.led(1,led01) led02 = ledbrightness if arm1[4] == "1" else 0 pyglow.led(2,led02) led03 = ledbrightness if arm1[3] == "1" else 0 pyglow.led(3,led03) led04 = ledbrightness if arm1[2] == "1" else 0 pyglow.led(4,led04) led05 = ledbrightness if arm1[1] == "1" else 0 pyglow.led(5,led05) led06 = ledbrightness if arm1[0] == "1" else 0 pyglow.led(6,led06) # Flash the white leds for the hour if hourcount != 0: sleep(0.5) if hourflash == 1: pyglow.color("white",ledbrightness) if hourflash == 2: pyglow.all(ledbrightness) sleep(0.5) hourcount = hourcount - 1 else: sleep(0.1)
## ## PyGlow ## ## python module to control Pimoronis PiGlow (http://shop.pimoroni.com/products/piglow) ## ## * test.py - set brightness for each color individually ## from pyglow import PyGlow pyglow = PyGlow() val = input("White: ") pyglow.color("white", val) val = input("Blue: ") pyglow.color("blue", val) val = input("Green: ") pyglow.color("green", val) val = input("Yellow: ") pyglow.color("yellow", val) val = input("Orange: ") pyglow.color("orange", val) val = input("Red: ") pyglow.color("red", val) val = input("All: ")
## from pyglow import PyGlow from time import sleep import psutil pyglow = PyGlow() while True: cpu = psutil.cpu_percent() pyglow.all(0) if cpu < 5: pyglow.color("white", 20) elif cpu < 20: pyglow.color("white", 20) pyglow.color("blue", 20) elif cpu < 40: pyglow.color("white", 20) pyglow.color("blue", 20) pyglow.color("green", 20) elif cpu < 60: pyglow.color("white", 20) pyglow.color("blue", 20) pyglow.color("green", 20) pyglow.color("yellow", 20) elif cpu < 80: pyglow.color("white", 20) pyglow.color("blue", 20)
## ! requires psutil - sudo apt-get install python-psutil ## from pyglow import PyGlow from time import sleep import psutil pyglow = PyGlow() while True: cpu = psutil.cpu_percent() pyglow.all(0) if cpu < 5: pyglow.color("white", 20) elif cpu < 20: pyglow.color("white", 20) pyglow.color("blue", 20) elif cpu < 40: pyglow.color("white", 20) pyglow.color("blue", 20) pyglow.color("green", 20) elif cpu < 60: pyglow.color("white", 20) pyglow.color("blue", 20) pyglow.color("green", 20) pyglow.color("yellow", 20) elif cpu < 80: pyglow.color("white", 20) pyglow.color("blue", 20)