示例#1
0
def abab(x, t):
    assert type(x) == int
    assert 0 <= x <= xmax
    for i in range(4):
        encode(x, pins)
        sleep(t)
        encode(xmax - x, pins)
        sleep(t)
示例#2
0
def aabb(x, t):
    assert type(x) == int
    assert 0 <= x <= xmax
    k = 0.7 # Defines how legato vs staccato
    for i in range(2):
        for j in range(2):
            encode(x, pins)
            sleep(t * k)
            clear(pins)
            sleep(t * (1-k))
        for j in range(2):
            encode(xmax - x, pins)
            sleep(t * k)
            clear(pins)
            sleep(t * (1-k))
示例#3
0
#!/usr/bin/env python

"""Count upwards in binary using four LEDs."""

from blinkenlights import setup, cleanup
from fourleds import encode, light, clear
from time import sleep

all_leds = [32, 22, 18, 16]
#           blu grn red yel

for p in all_leds:
    setup(p)

for i in range(31):
    encode(i, all_leds)
    sleep(1)

cleanup()