def gen_next(self):
     start = self._msTime()
     t = int(time.time())
     assert self._sleep, "GameOfLifeClock requires a set FPS!"
     self.next_history = self.generate_history(t + 60, 60000 // self._sleep)
     self.next_ready = True
     log.debug("History Generate Time: {}".format(self._msTime() - start))
    def step(self, amt=1):
        self._led.all_off()
        t = time.localtime()
        hrs = t.tm_hour % 12
        mins = t.tm_min
        sec = t.tm_sec

        h_hrs = hrs * (256 // 12)
        h_min = mins * (256 // 60)
        h_sec = sec * (256 // 60)

        grad = []

        grad += colors.hue_gradient(h_hrs, h_min, self.half)
        if self.odd:
            grad += [h_min]
        grad += colors.hue_gradient(h_min, h_sec, self.half)

        log.debug('{}:{}:{}'.format(hrs, mins, sec))

        for x in range(self.cdim):
            self._led.drawLine(x, 0, x, self._led.height - 1,
                               colors.hue2rgb(grad[x]))

        self._step = 0
from bibliopixel.animation import BaseMatrixAnim
from bibliopixel import log
import numpy as np
import cv2
import os

grab = None

if os.name == 'nt':
    try:
        from desktopmagic.screengrab_win32 import getRectAsImage, getScreenAsImage
        log.debug("Using desktopmagic module")

        def nt_grab(bbox=None):
            if bbox is None:
                img = getScreenAsImage()
            else:
                img = getRectAsImage(bbox)
            return img

        grab = nt_grab
    except:
        pass

if grab is None:
    try:
        from mss.linux import MSS as mss
        from PIL import Image
        log.info('Using mss module')

        sct = mss()
Example #4
0
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)
        anim = TicTacToe(led)
        anim.run(fps=10)
except:
    raise
finally:
    log.debug('All Off')
    for _ in range(10):
        led.all_off()
        led.update()
        time.sleep(0.1)
    log.debug('Off?')
Example #5
0
def shutdown():
    log.debug('Force close server')
    driver.server.close()
    time.sleep(2)
    sys.exit()
Example #6
0
                          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')
    for _ in range(10):
        led.all_off()
        led.update()
        time.sleep(0.1)
    log.debug('Off?')