Esempio n. 1
0
from time import sleep
from remote import RemoteDriver

d = RemoteDriver("wheel")

idx = 0
count_up = True
colors = [0,0,15]

while True:

	# Set the color
	for i in range(100):
		d.write_led(i, 255, colors[0], colors[1], colors[2])

	# Cycle through the wheel
	if count_up is True:
		colors[idx] += 1
		if colors[idx] == 15:
			count_up = False
			idx = (idx-1)%3
	else:
		colors[idx] -= 1
		if colors[idx] == 0:
			count_up = True
			idx = (idx-1)%3
Esempio n. 2
0
print "waiting our turn..."
import sys
if len(sys.argv) > 1 and sys.argv[1] == "emulator":
    driver = RemoteDriver("ExampleSine", "localhost")
else:
    driver = RemoteDriver("ExampleSine")
print "it's go time!"

offr = 0
offg = 0
offb = 0
offa = 0

while not driver.stop_signal():
    for i in range(100):
        xr = (i+offr) % 100
        xg = (i+offg) % 100
        xb = (i+offb) % 100
        xa = (i+offb) % 100
        yr = sin(xr/5.) * 8+7
        yg = sin(xg/5.) * 8+7
        yb = sin(xb/5.) * 8+7
        ya = sin(xa/10.) * 128+127
        driver.write_led(i,int(ya),int(yr),int(yg),int(yb))
    offr = (offr + 1) % 100
    offg = (offg + 2) % 100
    offb = (offb + 3) % 100
    offa = (offa + 1) % 100
    
    sleep(0.05)
Esempio n. 3
0
import time

print 'why no work'
print "what name are we: %s" % __name__

if __name__=="__main__":
    # Unit Test/Example Use:

    # This will block until it is your turn 
    print 'Waiting for our turn...'
    d = RemoteDriver("UnitTest")
    print 'Our turn!'

    # Turn off all the LEDs 
    for i in range(100):
        d.write_led(i, 0, 0, 0, 0)

    # Turn them back on from the top, with some delay (100*.05 = 5s)
    for i in range(100):
        d.write_led(i, 200, 13, 0, 13)
        time.sleep(.05)

    # Turn them off in chunks of 10 (10*2 = 20s)
    # Note that busy_wait must be used for delays >= 1s
    for i in range(100, 0, -10):
        for j in range(i, i-10, -1):
            d.write_led(j-1, 0, 0, 0, 0)
        d.busy_wait(2)

    # Turn on all the LEDs 
    for i in range(100):