コード例 #1
0
ファイル: xyz.py プロジェクト: mayhem/led-chandelier
import sys
import math
from chandelier import Chandelier, BROADCAST
import function
import generator
import filter
import random
import common
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/ttyAMA0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()
ch.set_brightness(BROADCAST, 100)

random.seed()

for i in xrange(1, 6):
    ch.set_color(i, Color(255, 0, 0))
    sleep(.21)

ch.set_position(1, -.6, 0, 0)
ch.set_position(2, -.3, 0, 0)
ch.set_position(3, .0, 0, 0)
ch.set_position(4, .3, 0, 0)
コード例 #2
0
#!/usr/bin/python

import os
import sys
import math
from chandelier import Chandelier, BROADCAST
import function
import generator
import filter
import random
import common
from time import sleep, time
from color import Color

device = "/dev/ttyAMA0"

if len(sys.argv) == 2:
    id = int(sys.argv[1])
else:
    print "Usage: %s <id>" % (sys.argv[0])
    sys.exit(-1)

print "Programming id %d" % id

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.clear_ids()
ch.set_id(id)
コード例 #3
0
import sys
import math
from chandelier import Chandelier, BROADCAST
import function
import generator
import filter
import random
import common
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/ttyAMA0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()

random.seed()
red = function.ConstantColor(Color(255, 0, 0))
red.chain(filter.Brightness(generator.Sawtooth(2)))

green = function.ConstantColor(Color(0, 255, 0))
green.chain(filter.Brightness(generator.Sawtooth(2)))

blue = function.ConstantColor(Color(0, 0, 255))
blue.chain(filter.Brightness(generator.Sawtooth(2)))

ch.send_pattern(BROADCAST, red)
コード例 #4
0
ファイル: speed.py プロジェクト: mayhem/hippie-trap
import sys
import math
from chandelier import Chandelier, BROADCAST
import function
import generator
import filter
import random
import common
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/ttyAMA0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()

random.seed()
green = function.ConstantColor(Color(0, 255, 0))
green.chain(filter.Brightness(generator.Sawtooth(2)))

print("100% speed")
ch.set_speed(BROADCAST, 1000)
ch.send_pattern(BROADCAST, green)
ch.next_pattern(BROADCAST, 0)
sleep(11)
print("200% speed")
ch.set_speed(BROADCAST, 2000)
コード例 #5
0
ファイル: speed.py プロジェクト: mayhem/led-chandelier
import sys
import math
from chandelier import Chandelier, BROADCAST
import function
import generator
import filter
import random
import common
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/ttyAMA0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()

random.seed()
green = function.ConstantColor(Color(0,255,0))
green.chain(filter.Brightness(generator.Sawtooth(2)))

print "100% speed"
ch.set_speed(BROADCAST, 1000)
ch.send_pattern(BROADCAST, green) 
ch.next_pattern(BROADCAST, 0)
sleep(11)
print "200% speed"
ch.set_speed(BROADCAST, 2000)
コード例 #6
0
# global variables that need to be moved to a UWSI block
speed = NORMAL_SPEED

DELAY = .02

device = "/dev/ttyAMA0"

r.seed()

#try:
#    import uwsgi
#    have_uwsgi = True
#except ImportError:
#    have_uwsgi = False

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()
ch.set_brightness(BROADCAST, 100)

for p in range(1, 105):
    ch.set_position(p, r.random(), r.random(), 0)

ch.send_pattern(BROADCAST, pattern_set[0][0])
ch.next_pattern(BROADCAST, 0)

pm = PatternMaster(ch)
if __name__ == '__main__':
    pm.start()
    app.run(host='0.0.0.0', port=8080)
コード例 #7
0
import os
import sys
import math
from chandelier import Chandelier, BROADCAST
from function import Pattern, sine, square
import common
from random import randint
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/serial0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()
ch.set_brightness(BROADCAST, 100)

# TODO:
#   - check impulse
#   - fix sin

p1 = Pattern(10,
        square(13, .5),
)

try:
    ch.send_pattern(2, p1)
コード例 #8
0
ファイル: set_ids.py プロジェクト: mayhem/led-chandelier
    print "abort!"
    sys.exit(-1) 

start_id = 1
if len(sys.argv) == 2:
    start_id = int(sys.argv[1])
else:
    print "Usage: %s <start_id>" % (sys.argv[0])
    sys.exit(-1)

print "Starting with id %d" % start_id

red = s.ConstantColor(Color(255, 0, 0))
red.chain(f.Brightness(g.Sin(.25)))

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)

id = start_id
while True:
    inp = raw_input("Hit enter to program node %d" % id)
    if inp.startswith("q"):
        break

    ch.clear_ids()
    ch.set_id(id)
    ch.set_classes([[id]])
    ch.send_pattern_to_class(0, red)
    ch.next_pattern(id, 0)
    sleep(1)
コード例 #9
0
ファイル: xyz.py プロジェクト: mayhem/hippie-trap
import sys
import math
from chandelier import Chandelier, BROADCAST
import function
import generator
import filter
import random
import common
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/ttyAMA0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()
ch.set_brightness(BROADCAST, 100)

random.seed()

for i in xrange(1, 6):
    ch.set_color(i, Color(255, 0, 0))
    sleep(.21)

ch.set_position(1, -.6, 0, 0)
ch.set_position(2, -.3, 0, 0)
ch.set_position(3, .0, 0, 0)
ch.set_position(4, .3, 0, 0)
コード例 #10
0
ファイル: set_ids.py プロジェクト: mayhem/hippie-trap
    print "abort!"
    sys.exit(-1)

start_id = 1
if len(sys.argv) == 2:
    start_id = int(sys.argv[1])
else:
    print "Usage: %s <start_id>" % (sys.argv[0])
    sys.exit(-1)

print "Starting with id %d" % start_id

red = s.ConstantColor(Color(255, 0, 0))
red.chain(f.Brightness(g.Sin(.25)))

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)

id = start_id
while True:
    inp = raw_input("Hit enter to program node %d" % id)
    if inp.startswith("q"):
        break

    ch.clear_ids()
    ch.set_id(id)
    ch.set_classes([[id]])
    ch.send_pattern_to_class(0, red)
    ch.next_pattern(id, 0)
    sleep(1)
コード例 #11
0
ファイル: clear_next.py プロジェクト: mayhem/led-chandelier
import sys
import math
from chandelier import Chandelier, BROADCAST
import function
import generator
import filter
import random
import common
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/ttyAMA0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()

random.seed()
red = function.ConstantColor(Color(255,0,0))
red.chain(filter.Brightness(generator.Sawtooth(2)))

green = function.ConstantColor(Color(0,255,0))
green.chain(filter.Brightness(generator.Sawtooth(2)))

blue = function.ConstantColor(Color(0,0,255))
blue.chain(filter.Brightness(generator.Sawtooth(2)))

ch.send_pattern(BROADCAST, red) 
コード例 #12
0
ファイル: function_test.py プロジェクト: mayhem/hippie-trap
import os
import sys
import math
from chandelier import Chandelier, BROADCAST
from function import Pattern, sine, square
import common
from random import randint
from time import sleep, time
from color import Color

DELAY = .02

device = "/dev/serial0"

ch = Chandelier()
ch.open(device)
ch.off(BROADCAST)
ch.send_entropy()
ch.set_brightness(BROADCAST, 100)

# TODO:
#   - check impulse
#   - fix sin

p1 = Pattern(
    10,
    square(13, .5),
)

try: