예제 #1
0
파일: solid.py 프로젝트: macintoxic/Firefly
    (4,2): 38,
    (4,3): 39,
    (4,4): 40,
    (4,5): 41,
    (5,5): 45,
    (5,4): 46,
    (5,3): 47,
    (5,2): 48,
    (5,1): 49,
    (5,0): 50
}

s = sched.scheduler(time.time, time.sleep)

swarm = Swarm(6, s)
swarm.begin_flashing(10000, 1, 0.03)

off = (0, 0, 0)
color_id = 0
color_dir = 0
rgb = False

def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.\
    if pos < 0 or pos > 255:
        r = g = b = 0
    elif pos < 85:
        r = int(pos * 3)
        g = int(255 - pos*3)
        b = 0
예제 #2
0
파일: main.py 프로젝트: macintoxic/Firefly
from swarm import Swarm
import sched, time

s = sched.scheduler(time.time, time.sleep)

swarm = Swarm(18, s)
swarm.begin_flashing(60, 1, 0.01)

import threading


def set_interval(func, sec):
    def func_wrapper():
        set_interval(func, sec)
        func()

    t = threading.Timer(sec, func_wrapper)
    t.start()
    return t


set_interval(swarm.print_status, 0.05)
s.run()