Пример #1
0
    binsec = "%06d" % int(bin(sec)[2:])

    # Check if current hour is different and set ready to flash hour
    if hourcurrent != hour:
        hourcount = hour
        hourcurrent = hour

    
    if armbottom == "h":
	arm3 = list(binhour)
    elif armbottom == "m":
        arm3 = list(binmin)
    else:
        arm3 = list(binsec)
    led13 = ledbrightness if arm3[5] == "1" else 0
    pyglow.led(13,led13)
    led14 = ledbrightness if arm3[4] == "1" else 0
    pyglow.led(14,led14)
    led15 = ledbrightness if arm3[3] == "1" else 0
    pyglow.led(15,led15)
    led16 = ledbrightness if arm3[2] == "1" else 0
    pyglow.led(16,led16)
    led17 = ledbrightness if arm3[1] == "1" else 0
    pyglow.led(17,led17)
    led18 = ledbrightness if arm3[0] == "1" else 0
    pyglow.led(18,led18)

    if armright == "h":
	arm2 = list(binhour)
    elif armright == "m":
        arm2 = list(binmin)
Пример #2
0
#! /usr/bin/python
#
print "Content-Type: text/html\n"

from pyglow import PyGlow
from time import sleep

pyglow = PyGlow()
pyglow.all(0)

max_brightness = 255 #(0 == off, 75 == bright, 255 == blinding!)
single_led = 2 #1-18

for x in range (0, max_brightness):
	pyglow.led(single_led, x)
	sleep(0.001)

for x in range (max_brightness, 0, -1):
	pyglow.led(single_led, x)
	sleep(0.001)

pyglow.all(0)
Пример #3
0
from pyglow import PyGlow # imports PyGlow module
from time import sleep

pyglow = PyGlow() # defines pyglow as the function PyGlow
pyglow.all(0) # sets all lights off

pyglow.led(1, 100)
sleep(1)
pyglow.led(1, 0)
sleep(1)

pyglow.update_leds()
Пример #4
0
number_leds = 18

while True:
	cpu_percent = psutil.cpu_percent(interval=11)
	number_to_display = (cpu_percent / (100/number_leds))
	cpu_rounded = int(number_to_display)
	print cpu_percent
	if (cpu_rounded > 18):
		cpu_rounded = 18
	# alter brightness based on load
	if (previous_value == cpu_rounded):
		brightness += 10
		if (brightness > 255):
			brightness = 255
	else:
		brightness -= 10
		if (brightness < 10):
			brightness = 10

	previous_value = cpu_rounded
	print ("Brightness: ", brightness)

	print ('led id:', cpu_rounded)
	pyglow.all(0)
	for count in xrange(0, cpu_rounded, 1):
		#pyglow.led(count, brightness)
		pyglow.led(led_list[count], brightness)

pyglow.update_leds()

Пример #5
0
#altered sample code from Pimoroni

from pyglow import PyGlow
from time import sleep

pyglow = PyGlow()

#set all the LEDs to off:
pyglow.all(0)

#turn on LEDs then off again
pyglow.led(1,100)
sleep(1)
pyglow.led(1,0)
sleep(1)

#light up the LEDs
pyglow.update_leds()


pyglow.led(2,100)
sleep(1)
pyglow.led(2,0)
sleep(1)
pyglow.update_leds()

pyglow.led(3,100)
sleep(1)
pyglow.led(3,0)
sleep(1)
pyglow.update_leds()