Exemplo n.º 1
0
def run(queue):
    from tricolorLED import TricolorLED

    LED = TricolorLED(LED_device)

    while 1:
        data = queue.get()

        if len(data) == 2:
            if data[0] == u'set':
                LED.setColor(*data[1])
            elif data[0] == u'sleep':
                sleep(data[1])
            elif data[0] == u'stop' and data[1] is True:
                LED.setColor(0, 0, 0)
Exemplo n.º 2
0
def run(queue):
    from tricolorLED import TricolorLED

    LED = TricolorLED(LED_device)

    while 1:
        data = queue.get()

        if len(data) == 2:
            if data[0] == u'set':
                LED.setColor(*data[1])
            elif data[0] == u'sleep':
                sleep(data[1])
            elif data[0] == u'stop' and data[1] is True:
                LED.setColor(0, 0, 0)
Exemplo n.º 3
0
import atexit

from random import randint

from tricolorLED import TricolorLED

def signal_handler(signal, frame):
        closeSerial()
        sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)

def closeSerial():
    myLED.close()
atexit.register(closeSerial)

myLED = TricolorLED(9)
#myLED.connect(9)

rLast = 0
gLast = 0
bLast = 0

while 1:
    rNew = randint(0, 255)
    gNew = randint(0, 255)
    bNew = randint(0, 255)

    res = 100.0
    
    for step in range(int(res)):
        myLED.setColor(rLast + (rNew-rLast)*(step/res),
Exemplo n.º 4
0
def signal_handler(signal, frame):
    closeSerial()
    sys.exit(0)


signal.signal(signal.SIGINT, signal_handler)


def closeSerial():
    myLED.close()


atexit.register(closeSerial)

myLED = TricolorLED(9)
#myLED.connect(9)

rLast = 0
gLast = 0
bLast = 0

while 1:
    rNew = randint(0, 255)
    gNew = randint(0, 255)
    bNew = randint(0, 255)

    res = 100.0

    for step in range(int(res)):
        myLED.setColor(rLast + (rNew - rLast) * (step / res),