All pastes #26973 Raw Edit

Miscellany

public python v1 · immutable
#26973 ·published 2005-10-29 00:49 UTC
rendered paste body
#!/usr/bin/pythonimport math, time# 0 = lit 1 = unlitpatterns = ["0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000000",            "0000000000000001",            "0000000000000001",            "0000000000000011",            "0000000000000111",            "0000000000001111",            "0000000000011111",            "0000000000111111",            "0000000001111111",            "0000000011111111",            "0000000111111111",            "0000001111111111",            "0000011111111111",            "0000111111111111",            "0001111111111111",            "0011111111111111",            "0111111111111111",            "1111111111111111"]costable = []rad = (math.pi/180)for i in range(1800):        c = abs(int( math.cos((i/10.0) * rad) * 16 ) ) + 18        if c >= len(patterns):                c = len(patterns) -1        costable.append(c)print costablefor w in range(1,16+1):        print w        for i in range(0,len(costable),w * 10):                print patterns[costable[i] - w]                for p in patterns[costable[i] - w]:                        gpio = file("/dev/gpio3","w")                        gpio.write(p)                        gpio.flush()                        time.sleep(0.0005)