def blink(lock, stop):
    with lock:
        while not stop.is_set():
            for i in range(phatbeat.CHANNEL_PIXELS):
                phatbeat.set_pixel(i, random.randint(0, 255), random.randint(0, 255), random.randint(0, 255), channel=random.randint(0,1))
            phatbeat.show()
            time.sleep(0.01)
Exemple #2
0
def turnon_led(led, red, green, blue, channel_mode=False):
    if channel_mode == True:
        for channel in (0, 1):
            phatbeat.set_pixel(led, red, green, blue, channel=channel)
    else:
        phatbeat.set_pixel(led, red, green, blue)

    phatbeat.show()
def phatbeat_wait():
    #global player
    #player = 'wait'
    phatbeat.clear()
    #phatbeat.set_all(0, 255, 0)
    #for channel in (0,1):
    phatbeat.set_pixel(0, 0, 255, 0, 0.1, 0)
    phatbeat.set_pixel(0, 0, 0, 255, 0.1, 1)
    phatbeat.show()
def rainbow(lock, stop):
    SPEED = 200
    BRIGHTNESS = 64
    SPREAD = 20
    with lock:
        while not stop.is_set():
            for x in range(phatbeat.CHANNEL_PIXELS):
                h = (time.time() * SPEED + (x * SPREAD)) % 360 / 360.0
                r, g, b = [int(c*BRIGHTNESS) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)]
                phatbeat.set_pixel(x, r, g, b, channel=0)
                phatbeat.set_pixel(x, r, g, b, channel=1)
            phatbeat.show()
            time.sleep(0.001)
Exemple #5
0
def rainbow():
    SPEED = 300
    BRIGHTNESS = 64
    SPREAD = 20

    #while True:
    for cycles in range(1, 200):
        for x in range(phatbeat.CHANNEL_PIXELS):
            h = (time.time() * SPEED + (x * SPREAD)) % 360 / 360.0
            r, g, b = [int(c*BRIGHTNESS) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)]
            phatbeat.set_pixel(x, r, g, b, channel=0)
            phatbeat.set_pixel(x, r, g, b, channel=1)

        phatbeat.show()
        time.sleep(0.001)
    time.sleep(0.1)
    phatbeat.set_all(0,0,0)
Exemple #6
0
def rainbow():
    SPEED = 300
    BRIGHTNESS = 64
    SPREAD = 20

    #while True:
    for cycles in range(1, 200):
        for x in range(phatbeat.CHANNEL_PIXELS):
            h = (time.time() * SPEED + (x * SPREAD)) % 360 / 360.0
            r, g, b = [
                int(c * BRIGHTNESS) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)
            ]
            phatbeat.set_pixel(x, r, g, b, channel=0)
            phatbeat.set_pixel(x, r, g, b, channel=1)

        phatbeat.show()
        time.sleep(0.001)
    time.sleep(0.1)
    phatbeat.set_all(0, 0, 0)
Exemple #7
0
#!/usr/bin/env python3
# copy to /usr/local/bin/blinky and use with blinky.service

import phatbeat
import colorsys
import time

SPEED = 200
BRIGHTNESS = 128
SPREAD = 20

while True:
    for x in range(phatbeat.CHANNEL_PIXELS):
        h = (time.time() * SPEED + (x * SPREAD)) % 360 / 360.0
        r, g, b = [
            int(c * BRIGHTNESS) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)
        ]
        phatbeat.set_pixel(x, r, g, b, channel=0)
        phatbeat.set_pixel(x, r, g, b, channel=1)

    phatbeat.show()
    time.sleep(0.001)
def phatbeat_start():
    phatbeat.clear()
    #phatbeat.set_all(255, 0, 255)
    for p in range(16):
	phatbeat.set_pixel(p, 200, 0, 255, 0.1)
    phatbeat.show()