Esempio n. 1
0
    def setUp(self):
        #logging.basicConfig(level=logging.INFO)
        ws = self.ws = WS2812(1, 8)
        lights = self.lights = Lights(ws)

        # Fill the lattice with a recognizable pattern
        for i, p in enumerate(tg(len(lights), 0)):
            lat = lights.lattice[i]
            for j, c in enumerate(p):
                lat[j] = c

        # The leds are all clear
        self.assertEqual(sum(sum(c) for c in ws), 0)

        self.rr = RingRamp(leds=lights.leds,
                           lattice=lights.lattice,
                           indexed_range=lights.indexed_range)
Esempio n. 2
0
    def __init__(self, write_fun=None, config={}):
        self.config = config

        if write_fun is None:

            @coroutine
            def write(self, *args):
                print(*args)

            self.write = write
        else:
            self.write = write_fun

        self.act_led = pyb.LED(3)
        self.err_led = pyb.LED(1)
        self.pkt_led = pyb.LED(2)

        self.pots = [0] * 4

        self.percolator = \
                Percolator(WS2812(spi_bus=config['leds'].get('spi'),
                                  led_count=config['leds'].get('qty')))
        self.percolator.bingo = self.bingo

        self.ws_rings = WS2812(2, 2 * 7 + 45)
        self.ring_lights = Lights(self.ws_rings)

        self.feed_rollers = [
            Jewel7(lights=self.ring_lights[0:7]),
            Jewel7(lights=self.ring_lights[7:14])
        ]

        self.rr = RingRamp(lights=self.ring_lights[14:],
                           circumference=60, \
                           bottom=7, \
                           g=-40.0,
                           ball_check_fun = self.ball_check)

        #        self.zap_balls = False
        self.set_brightness(31)