Example #1
0
def main():
    parser = ArgumentParser()
    parser.add_argument("--width", help="Display width", default=8, type=int)
    parser.add_argument("--height", help="Display height", default=8, type=int)
    parser.add_argument("--bright", help="Brightness Level", default=255, type=int)
    parser.add_argument("--ip", help="Remote IP Address", default="10.0.1.133", type=str, required=True)
    args = parser.parse_args()

    driver = DriverNetworkUDP(num=args.width * args.height,
                              width=args.width, height=args.height,
                              host=args.ip, port=1822)
    try:
        led = LEDMatrix(driver, width=args.width, height=args.height, coordMap=None,
                        rotation=MatrixRotation.ROTATE_90, vert_flip=False,
                        serpentine=True, threadedUpdate=True,
                        masterBrightness=args.bright, pixelSize=(1, 1))

        anim = GenericNetworkReceiver(led, port=3142, interface='0.0.0.0')
        anim.run(threaded=True)

        PixelPainter(n_row=args.width, n_col=args.height,
                     display_ip="127.0.0.1", display_port=3142)
    except Exception as e:
        print("Exception Encountered!", e)
    finally:
        # NetworkUDP might miss off... really hammer it
        for _ in range(10):
            led.all_off()
            led.update()
            time.sleep(0.1)
Example #2
0
def getPixelArray(pixel_map, dev, rotation, vert_flip):
    '''
        pixel_map -- MultiMap Builder
        dev -- com port ident string
        '''
    width = len(pixel_map.map[0])
    height = len(pixel_map.map)
    n_pixel = width * height
    driver = DriverSerial(LEDTYPE.GENERIC,
                          n_pixel,
                          hardwareID="16C0:0483",
                          dev=dev)
    led = LEDMatrix(driver,
                    width=width,
                    height=height,
                    coordMap=pixel_map.map,
                    rotation=rotation,
                    vert_flip=vert_flip)
    return led
Example #3
0
def main():
    parser = ArgumentParser()
    parser.add_argument("--width", help="Display width", default=8, type=int)
    parser.add_argument("--height", help="Display height", default=8, type=int)
    parser.add_argument("--bright",
                        help="Brightness Level",
                        default=255,
                        type=int)
    parser.add_argument("--ip",
                        help="Remote IP Address",
                        default="10.0.1.133",
                        type=str,
                        required=True)
    args = parser.parse_args()

    driver = DriverNetworkUDP(num=args.width * args.height,
                              width=args.width,
                              height=args.height,
                              host=args.ip,
                              port=1822)
    try:
        led = LEDMatrix(driver,
                        width=args.width,
                        height=args.height,
                        coordMap=None,
                        rotation=MatrixRotation.ROTATE_90,
                        vert_flip=False,
                        serpentine=True,
                        threadedUpdate=True,
                        masterBrightness=args.bright,
                        pixelSize=(1, 1))

        anim = GenericNetworkReceiver(led, port=3142, interface='0.0.0.0')
        anim.run(threaded=True)

        PixelPainter(n_row=args.width,
                     n_col=args.height,
                     display_ip="127.0.0.1",
                     display_port=3142)
    except Exception as e:
        print("Exception Encountered!", e)
    finally:
        # NetworkUDP might miss off... really hammer it
        for _ in range(10):
            led.all_off()
            led.update()
            time.sleep(0.1)
Example #4
0
def main():
    parser = ArgumentParser()
    parser.add_argument("--width", help="Display width", default=8, type=int)
    parser.add_argument("--height",
                        help="Display height",
                        default=16,
                        type=int)
    args = parser.parse_args()
    driver = DriverVisualizer(num=0,
                              width=args.width,
                              height=args.height,
                              pixelSize=15,
                              port=1618,
                              stayTop=True)

    led = LEDMatrix(driver, serpentine=True, threadedUpdate=False)

    anim = GenericNetworkReceiver(led, port=3142, interface='0.0.0.0')
    anim.run(threaded=True)

    PixelPainter(n_row=args.height,
                 n_col=args.width,
                 display_ip="127.0.0.1",
                 display_port=3142)
Example #5
0
from bibliopixel.drivers.serial_driver import DriverSerial, LEDTYPE
from bibliopixel import LEDMatrix, log
from BiblioPixelAnimations.matrix.bloom import Bloom
log.setLogLevel(log.DEBUG)

driver = DriverSerial(LEDTYPE.GENERIC,
                      64,
                      hardwareID="16C0:0483",
                      dev="/dev/ttyACM0")
led = LEDMatrix(driver)

try:
    anim = Bloom(led, dir=True)
    anim.run(amt=1, fps=15)
except:
    led.all_off()
    led.update()
from bibliopixel import LEDMatrix
from bibliopixel.drivers.serial_driver import DriverSerial, ChannelOrder, LEDTYPE
import bibliopixel.colors as colors
import time

driver = DriverSerial(LEDTYPE.GENERIC, 32*32, hardwareID="16C0:0483")
led = LEDMatrix(driver, width=32, height=32, serpentine=False)

print "Red"
led.fill(colors.Red)
led.update()
time.sleep(1)

print "Green"
led.fill(colors.Green)
led.update()
time.sleep(1)

print "Blue"
led.fill(colors.Blue)
led.update()
time.sleep(1)

print "Off"
led.fill(colors.Off)
led.update()
time.sleep(1)
Example #7
0
import time
from operator import or_, ior, ixor
# import matplotlib.pyplot as plt
import BiblioPixelAnimations.matrix.bloom as BA
import BiblioPixelAnimations.strip.Wave as WA
import sys

from bibliopixel.wormanimclass import pathgen
# set up led with it's driver for the MasterAnimation
try:  # to use visualizer but if fails
    drivermaster = DriverVisualizer(160,
                                    pixelSize=62,
                                    stayTop=False,
                                    maxWindowWidth=1024)
    ledmaster = LEDMatrix(drivermaster,
                          width=16,
                          height=10,
                          threadedUpdate=False)
except:
    # assume on my pi and connect to strip, however a process of visualizerUI.py will have
    # been started and will fail
    drivermaster = DriverLPD8806(160)
    ledmaster = LEDMatrix(drivermaster,
                          width=16,
                          height=10,
                          threadedUpdate=False)

# Set up animations that will run concurrently
# Wave arguments
waveblue = ((0, 0, 255), 1)
wavered = ((0, 255, 0), 1)
wavegreen = ((255, 0, 0), 1)
Example #8
0
import re
import time
from operator import or_, ior, ixor
# import matplotlib.pyplot as plt
import BiblioPixelAnimations.matrix.MatrixRain as MR
import BiblioPixelAnimations.strip.Wave as WA
import sys

sys.path.append('D:\Bill\SpyderWork')  # to get wormanimclass
from wormanimclass import Worm, pathgen
# set up led with it's driver for the MasterAnimation
drivermaster = DriverVisualizer(160,
                                pixelSize=62,
                                stayTop=False,
                                maxWindowWidth=1024)
ledmaster = LEDMatrix(drivermaster, width=16, height=10, threadedUpdate=False)

# Set up animations that will run concurrently
# Some worms
# segment colors

lnin = [200, 100]
bluedimming = [(0, 0, i) for i in lnin]
reddimming = [(i, 0, 0) for i in lnin]
greendimming = [(0, i, 0) for i in lnin]
cyandimming = [(0, i, i) for i in lnin]
whitedimming = [(i, i, i) for i in lnin]

# Worm arguments
wormblue = (bluedimming, None, 1, 1, 2)
wormred = (reddimming, None, 1, 1, 2)
Example #9
0
from logging import DEBUG, INFO, WARNING, CRITICAL, ERROR
from bibliopixel import log
log.setLogLevel(WARNING)
import re
import time
from operator import or_, ior, ixor
# import matplotlib.pyplot as plt
import BiblioPixelAnimations.matrix.bloom as BA
import BiblioPixelAnimations.strip.Wave as WA
import sys

sys.path.append('D:\Bill\SpyderWork') # to get wormanimclass
from wormanimclass import Worm, pathgen
# set up led with it's driver for the MasterAnimation
drivermaster = DriverVisualizer(160, pixelSize=62, stayTop=False, maxWindowWidth=1024)
ledmaster = LEDMatrix(drivermaster, width=16, height=10, threadedUpdate=False, masterBrightness=255)

# Set up animations that will run concurrently
# Wave arguments
waveblue = ((0,0,255), 1)
wavered = ((0, 255, 0), 1)
wavegreen = ((255, 0, 0), 1)
wavecyan = ((255, 0, 255), 1)
wavewhite = ((255, 255, 255), 1)

# Wave slave driver arguments
wavebluepixmap = pathgen(1, 15, 0, 9)
waveredpixmap = pathgen(1, 14, 1, 8)
wavegreenpixmap = pathgen(2, 13, 2, 7)
wavecyanpixmap = pathgen(3, 12, 3, 6)
wavewhitepixmap = pathgen(4, 11, 4, 5)
Example #10
0
h = 32
dCount = 3
d_order = [10, 11, 12]

build = MultiMapBuilder()
drivers = []
for i in range(dCount):
    build.addRow(mapGen(w, h, serpentine=False))
    drivers.append(
        DriverTeensySmartMatrix(width=w, height=h, deviceID=d_order[i]))

# print(build.map)

led = LEDMatrix(drivers,
                width=w,
                height=h * dCount,
                coordMap=build.map,
                threadedUpdate=not True,
                masterBrightness=128)

anim = Bloom(led)
try:
    anim.run(amt=6, fps=6)
finally:
    anim.cleanup()
    time.sleep(1)
    led.all_off()
    led.update()
    time.sleep(1)
    led.all_off()
    led.update()
TinyTest
Example #11
0
from bibliopixel.drivers.serial_driver import DriverSerial, LEDTYPE
from bibliopixel import LEDMatrix, log
from BiblioPixelAnimations.matrix.bloom import Bloom
log.setLogLevel(log.DEBUG)

driver = DriverSerial(LEDTYPE.GENERIC, 64*3, hardwareID="16C0:0483", dev="/dev/ttyACM0")
led = LEDMatrix(driver, width=24, height=8)

try:
    anim = Bloom(led, dir=True)
    anim.run(amt=1, fps=15)
except:
    raise
    led.all_off()
    led.update()
Example #12
0
    def step(self, amt=1):
        pass


if __name__ == '__main__':
    pixelSize = (2, 2)
    masterBrightness = 200

    width = 8
    height = 8
    driver = DriverVisualizer(width=width,
                              height=height,
                              pixelSize=50,
                              stayTop=True)
    led = LEDMatrix(driver,
                    pixelSize=pixelSize,
                    masterBrightness=masterBrightness)
    ri = random.randint
    tex = [[(ri(0, 255), ri(0, 255), ri(0, 255))
            for i in range(width / pixelSize[0])]
           for j in range(height / pixelSize[1])]
    dum = Dummy(led)
    dum._led.setTexture(tex)
    dum._led.all_off()
    print "masterBrightness is {}".format(dum._led.masterBrightness)
    print "Pixel size {}".format(dum._led.pixelSize)
    print "Numer of scaled pixels {}".format(dum._led.numLEDs)
    print "set scaled pixel 0,0 to red and scaled pixel 1,0 to green scaled pixel 1,1 to texture"
    dum._led.set(0, 0, (255, 0, 0))
    dum._led.update()
    px1c = (0, 255, 0)
Example #13
0
#causes frame timing information to be output
bibliopixel.log.setLogLevel(bibliopixel.log.DEBUG)

from BiblioPixelAnimations.matrix.bloom import Bloom

from bibliopixel.drivers.SimPixel import DriverSimPixel
from bibliopixel import LEDMatrix
from bibliopixel.animation import MatrixCalibrationTest
from bibliopixel.layout.circle import *
from bibliopixel.led import LEDCircle

x = y = 32

if not False:
    driver = DriverSimPixel(x * y, layout=None)
    led = LEDMatrix(driver, width=x, height=y)
    # anim = MatrixCalibrationTest(led)
    anim = Bloom(led)

else:
    pixels_per = [1, 4, 8, 12, 18, 24, 32, 40, 52, 64]
    rings, steps = gen_circle(rings=None, pixels_per=pixels_per, offset=0, invert=False)
    points = point_list_from_rings(rings, origin=(200, 200, 0), z_diff=8)
    driver = DriverSimPixel(sum(pixels_per), port=1337, layout=points)
    led = LEDCircle(driver, rings=rings, maxAngleDiff=0)

anim.run()


#from BiblioPixelAnimations.circle.diag import Diag
# from simplex import Simplex
        # normalize output
        height = (eq_data[2] - 10.2) / 5
        if height < .05:
            height = .05
        elif height > 1.0:
            height = 1.0

        numPix = int(round(height*(self.height/2)))

        for y in range(self.height):
            if y < int(numPix):
                self._led.drawCircle(self.width/2, self.height/2, y, self.colors[y*2])

        self._step += amt

if __name__ == '__main__':
    from bibliopixel.drivers.visualizer import DriverVisualizer, ChannelOrder
    from bibliopixel import LEDStrip, LEDMatrix
    from bibliopixel.drivers.network import DriverNetwork

    #driver = DriverVisualizer(width=16, height=10, pixelSize=62, stayTop=False, maxWindowWidth=1024)
    #led = LEDMatrix(driver, width=16, height=10, serpentine=True, masterBrightness=255, masterBrightnessLimit=255)
    driver = DriverNetwork(width=16, height=10, host='192.168.1.170')
    led = LEDMatrix(driver, width=16, height=10, serpentine=False, vert_flip=True, masterBrightness=255, masterBrightnessLimit=255)

    eq = EQ(led, xleft=6, xright=12, minFrequency=100, maxFrequency=2000)
    eq.run()
#               
    bp = BassPulse(led, minFrequency=50, maxFrequency=2000)
    bp.run()
    
Example #15
0
import re
import time
from operator import or_, ior, ixor
# import matplotlib.pyplot as plt
import BiblioPixelAnimations.matrix.bloom as BA
import BiblioPixelAnimations.strip.Wave as WA
import sys

sys.path.append('D:\Bill\SpyderWork')  # to get wormanimclass
from wormanimclass import Worm, pathgen
# set up led with it's driver for the MasterAnimation
drivermaster = DriverVisualizer(160,
                                pixelSize=62,
                                stayTop=False,
                                maxWindowWidth=1024)
ledmaster = LEDMatrix(drivermaster, width=16, height=10, threadedUpdate=False)

# Set up animations that will run concurrently
# Some worms
# segment colors

lnin = [255, 222, 200, 150, 125]
bluedimming = [(0, 0, i) for i in lnin]
reddimming = [(i, 0, 0) for i in lnin]
greendimming = [(0, i, 0) for i in lnin]
cyandimming = [(0, i, i) for i in lnin]
whitedimming = [(i, i, i) for i in lnin]

# Worm arguments
wormblue = (bluedimming, None, 1, 1, 6)
wormred = (reddimming, None, 1, 1, 2)
Example #16
0
                         broadcast=False,
                         host=base_ip + str(i),
                         port=1822))

print("setup matrix")
build = MultiMapBuilder()
for _ in range(3):
    build.addRow(mapGen(w, h, rotation=rotation),
                 mapGen(w, h, rotation=rotation),
                 mapGen(w, h, rotation=rotation))

led = LEDMatrix(drivers,
                width=w * 3,
                height=h * 3,
                coordMap=build.map,
                rotation=MatrixRotation.ROTATE_0,
                vert_flip=False,
                serpentine=True,
                threadedUpdate=False,
                masterBrightness=64,
                pixelSize=(1, 1))

try:
    print("run anim")
    while True:
        # anim = Bloom(led, dir=True)
        # anim.run(amt=6, fps=15)
        # anim = ScrollText(led, "Hello World", xPos=w,
        #                   color=(255, 0, 0), font_scale=3)
        # anim.run(amt=1, fps=15)
        # anim = Spectrum(led, vis_list=['BasicLineGraph'], steps_per_vis=100,
        #                 bins=16, max_freq=4000, log_scale=True, auto_gain=True, gain=3)
Example #17
0
    #wormdatalist = [(wormwhite, 8)]
    #wormdatalist = []

    # dummy strips must each have their own slavedriver as thread is attached
    # to the driver
    ledslaves = [
        LEDStrip(DriverSlave(160, pixheights=-1), threadedUpdate=True)
        for _ in range(len(wormdatalist))
    ]

    # Make the Worm animations an list pairs (animation, fps)
    wormlist = [(Worm(ledslaves[i], *d[0]), d[1])
                for i, d in enumerate(wormdatalist)]

    ledslaveb = LEDMatrix(DriverSlave(160, None, 0),
                          width=16,
                          height=10,
                          threadedUpdate=True)
    bloom = BA.Bloom(ledslaveb)
    wormlist.append((bloom, 10))

    #masteranimation = MasterAnimation(ledmaster, [w._led for w, f in wormlist])
    masteranimation = MasterAnimation(ledmaster, wormlist)

    starttime = time.time()
    runtime = 1

    # Master steps when it gets a go ahdead signal from one of the
    # concurrent annimations
    masteranimation.run(
        fps=None)  # if give fps for master will skip faster frames
Example #18
0
        # x = 0
        # for y in eq_data:
        #     self._led.drawLine(x, self._led.height - 1, x, self._led.height - int(y), colors.hue_helper(int(y), self._led.height, 0))
        #     x += 1
        self._step = amt
            
#Load driver for your hardware, visualizer just for example
# from bibliopixel.drivers.visualizer import DriverVisualizer
# driver = DriverVisualizer(width = 24, height = 24, stayTop = True)

from bibliopixel.drivers.serial_driver import *
import bibliopixel.gamma as gamma
num = 24*24
print "Pixel Count: {}".format(num)
driver = DriverSerial(LEDTYPE.LPD8806, num, c_order=ChannelOrder.BRG, SPISpeed=2, gamma = gamma.LPD8806)

#load the LEDMatrix class
from bibliopixel.led import *
#change rotation and vert_flip as needed by your display
led = LEDMatrix(driver, rotation = MatrixRotation.ROTATE_0, vert_flip = True)
led.setMasterBrightness(128)
import bibliopixel.log as log
#log.setLogLevel(log.DEBUG)

try:
    anim = EQ(led)
    anim.run(fps=30)
except KeyboardInterrupt:
    anim.endRecord()
    led.all_off()
    led.update()
Example #19
0
print("connecting")
base_ip = '10.0.1.3'
drivers = []
for i in range(1, 10):
    drivers.append(DriverNetworkUDP(num=w * h, broadcast=False,
                                    host=base_ip + str(i), port=1822))

print("setup matrix")
build = MultiMapBuilder()
for _ in range(3):
    build.addRow(mapGen(w, h, rotation=rotation),
                 mapGen(w, h, rotation=rotation),
                 mapGen(w, h, rotation=rotation))

led = LEDMatrix(drivers, width=w * 3, height=h * 3, coordMap=build.map,
                rotation=MatrixRotation.ROTATE_0, vert_flip=False,
                serpentine=True, threadedUpdate=False,
                masterBrightness=64, pixelSize=(1, 1))

try:
    print("run anim")
    while True:
        # anim = Bloom(led, dir=True)
        # anim.run(amt=6, fps=15)
        # anim = ScrollText(led, "Hello World", xPos=w,
        #                   color=(255, 0, 0), font_scale=3)
        # anim.run(amt=1, fps=15)
        # anim = Spectrum(led, vis_list=['BasicLineGraph'], steps_per_vis=100,
        #                 bins=16, max_freq=4000, log_scale=True, auto_gain=True, gain=3)
        # anim.run(amt=1, fps=10, seconds=10)
        # anim = MatrixRainBow(led)
        # anim.run(fps=15)
Example #20
0
log.setLogLevel(log.DEBUG)

numLEDs = 64

print("connecting")
driver = DriverNetworkUDP(num=numLEDs,
                          broadcast=False,
                          host="10.0.1.33",
                          port=1822)

print("setup matrix")
led = LEDMatrix(driver,
                width=8,
                height=numLEDs // 8,
                coordMap=None,
                rotation=MatrixRotation.ROTATE_0,
                vert_flip=False,
                serpentine=True,
                threadedUpdate=False,
                masterBrightness=255,
                pixelSize=(1, 1))

print("setup anim")
anim = Bloom(led, dir=True)

try:
    print("run anim")
    anim.run(amt=6, fps=15)
except:
    raise
finally:
    log.debug('All Off')
Example #21
0
    parser.add_argument('--sensitivity', default=3, type=float)  # lower is more sensitive
    args = parser.parse_args()

    if args.display == 'full':
        w = 140
        h = 140
        driver = DriverPieva(width=w, height=h)
    else:
        w = 70
        h = 70
        if args.display == 'x4':
            driver = DriverPievaX4(width=w, height=h)
        else:
            driver = DriverPievaX4Rev(width=w, height=h)

    led = LEDMatrix(driver, width=w, height=h, serpentine=False)
    led.setMasterBrightness(255)

    if args.recorder == 'alsa':
        recorder = AlsaRecorder()
    else:
        recorder = PyAudioRecorder()

    if args.anim == 'eq':
        anim = EQ(recorder, led, args.min_freq, args.max_freq, args.sensitivity)
    elif args.anim == 'bass':
        anim = BassPulse(recorder, led, args.min_freq, args.max_freq, args.sensitivity)
    else:
        from bibliopixel.animation import MatrixCalibrationTest, MatrixChannelTest
        anim = MatrixCalibrationTest(led)
from bibliopixel.led import *

import bibliopixel.gamma as gamma
w = 12
h = 20
print "Pixel Count: {}".format(w*h)

parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
parser.add_argument("--visualizer", help="use the visualization driver", action="store_true")
parser.add_argument("--network", help="use the network driver", action="store_true")
args = parser.parse_args()
    
if args.visualizer:
    driver = DriverVisualizer(width = w, height = h, stayTop = True)
    led = LEDMatrix(driver, width = w, height = h)
else:
    driver = DriverNetwork(num=w*h, width=w, height=h, host = "192.168.210.203")
    #load the LEDMatrix class
    #change rotation and vert_flip as needed by your display
    led = LEDMatrix(driver, width = h, height = w, rotation = MatrixRotation.ROTATE_270, vert_flip = True)
 

led.setMasterBrightness(255)
import bibliopixel.log as log
#log.setLogLevel(log.DEBUG)
 
minFrequency   = float(50) # 50 Hz
maxFrequency   = float(15000) # 15000 HZ

try: