Ejemplo n.º 1
0
    def step(self, amt=1):
        self._led.all_off()
        t = time.localtime()
        hrs = t.tm_hour % 12
        min = t.tm_min
        sec = t.tm_sec

        p_hrs = pointOnCircle(self._centerX, self._centerY,
                              int(self._centerX * 0.7), hrs * 30)
        p_min = pointOnCircle(self._centerX, self._centerY, self._centerX,
                              min * 6)
        p_sec = pointOnCircle(self._centerX, self._centerY, self._centerX,
                              sec * 6)

        c_hrs = colors.hue2rgb_rainbow(t.tm_hour * (256 / 24))

        c_min = colors.hue2rgb_rainbow(min * (256 / 60))

        c_sec = colors.hue2rgb_rainbow(sec * (256 / 60))

        self._led.drawLine(self._centerX, self._centerY, p_hrs[0], p_hrs[1],
                           c_hrs)
        self._led.drawLine(self._centerX, self._centerY, p_min[0], p_min[1],
                           c_min)
        self._led.drawLine(self._centerX, self._centerY, p_sec[0], p_sec[1],
                           c_sec)

        self._step = 0
Ejemplo n.º 2
0
    def step(self, amt=1):
        t = time.localtime()

        r, g, b = colors.hue2rgb_rainbow(t.tm_hour * (256 / 24))
        self._led.fillRGB(r, g, b, self._hStart, self._hEnd)

        r, g, b = colors.hue2rgb_rainbow(t.tm_min * (256 / 60))
        self._led.fillRGB(r, g, b, self._mStart, self._mEnd)

        r, g, b = colors.hue2rgb_rainbow(t.tm_sec * (256 / 60))
        self._led.fillRGB(r, g, b, self._sStart, self._sEnd)

        self._step = 0
Ejemplo n.º 3
0
    def step(self, amt = 1):
        t = time.localtime()

        r, g, b = colors.hue2rgb_rainbow(t.tm_hour * (256/24))
        self._led.fillRGB(r,g,b,self._hStart,self._hEnd)

        r, g, b = colors.hue2rgb_rainbow(t.tm_min * (256/60))
        self._led.fillRGB(r,g,b,self._mStart,self._mEnd)

        r, g, b = colors.hue2rgb_rainbow(t.tm_sec * (256/60))
        self._led.fillRGB(r,g,b,self._sStart,self._sEnd)

        self._step = 0
Ejemplo n.º 4
0
    def step(self, amt = 1):
        for i in range(self._size):
            h = (i + self._step) % 255
            self._led.set(self._start + i, colors.hue2rgb_rainbow(h))

        self._step += amt
        overflow = self._step - 256
        if overflow >= 0:
            self._step = overflow
Ejemplo n.º 5
0
    def step(self, amt):
        octaves = 1
        freq = 16.0
        data = []
        for y in range(self.height):
            for x in range(self.width):
                v = int(pnoise3(x / self._freq, y / self._freq, self._step / self._freq, octaves=self._octaves) * 127.0 + 128.0)
                c = colors.hue2rgb_rainbow(v)
                self._led.set(x,y, c)

        self._step += amt
Ejemplo n.º 6
0
    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

        p_hrs = pointOnCircle(self._centerX, self._centerY,
                              int(self.hand_length * 0.7), hrs * 30)
        p_min = pointOnCircle(self._centerX, self._centerY, self.hand_length,
                              mins * 6)
        p_sec = pointOnCircle(self._centerX, self._centerY, self.hand_length,
                              sec * 6)

        c_hrs = colors.hue2rgb_rainbow(hrs * (256 / 12))

        c_min = colors.hue2rgb_rainbow(mins * (256 / 60))

        c_sec = colors.hue2rgb_rainbow(sec * (256 / 60))

        self._led.drawLine(self._centerX,
                           self._centerY,
                           p_hrs[0],
                           p_hrs[1],
                           c_hrs,
                           aa=self.aa)
        self._led.drawLine(self._centerX,
                           self._centerY,
                           p_min[0],
                           p_min[1],
                           c_min,
                           aa=self.aa)
        self._led.drawLine(self._centerX,
                           self._centerY,
                           p_sec[0],
                           p_sec[1],
                           c_sec,
                           aa=self.aa)

        self._step = 0
    def step(self, amt = 1):
        self._led.all_off()
        t = time.localtime()
        hrs = t.tm_hour % 12
        min = t.tm_min
        sec = t.tm_sec

        p_hrs = pointOnCircle(self._centerX, self._centerY, int(self._centerX * 0.7), hrs * 30)
        p_min = pointOnCircle(self._centerX, self._centerY, self._centerX, min * 6)
        p_sec = pointOnCircle(self._centerX, self._centerY, self._centerX, sec * 6)

        c_hrs = colors.hue2rgb_rainbow(t.tm_hour * (256/24))

        c_min = colors.hue2rgb_rainbow(min * (256/60))

        c_sec = colors.hue2rgb_rainbow(sec * (256/60))

        self._led.drawLine(self._centerX, self._centerY, p_hrs[0], p_hrs[1], c_hrs)
        self._led.drawLine(self._centerX, self._centerY, p_min[0], p_min[1], c_min)
        self._led.drawLine(self._centerX, self._centerY, p_sec[0], p_sec[1], c_sec)

        self._step = 0
    def step(self, amt):
        octaves = 1
        freq = 16.0
        data = []
        for y in range(self.height):
            for x in range(self.width):
                v = int(
                    self.func(x / self._freq,
                              y / self._freq,
                              self._step / self._freq,
                              octaves=self._octaves) * 127.0 + 128.0)
                c = colors.hue2rgb_rainbow(v)
                self._led.set(x, y, c)

        self._step += amt
Ejemplo n.º 9
0
    def step(self, amt = 1):
        for y in range(h):
			for x in range(w):
				c = colors.hue2rgb_360(self._step)
				led.set(x, y, c)
				c = led.get(x, y)
				c = colors.hsv2rgb_rainbow((c[2], c[0], c[1]))
				c = colors.hue2rgb_rainbow(c[0])
				c = colors.hue2rgb_spectrum(c[1])
				c = colors.hue2rgb_raw(c[2])
				c = colors.color_scale(c, c[0])
				c = colors.color_scale(c, c[1])
				c = colors.color_scale(c, c[2])
				led.set(x, y, c)

        self._step += 1
        if self._step >= 360:
        	self._step = 0
    def step(self, amt=1):

        for j in range(0, self._num_segments):
            led_index = (j * self._segment_size) + self._start + self._step
            self._led.fill(colors.hue2rgb_rainbow(self._color_step), led_index,
                           led_index)

        self._step += amt
        overflow = (self._start + self._step) - (self._segment_size)
        if overflow >= 0:
            self._step = overflow

        if self._color_step == len(colors.hue_rainbow) - 1:
            self._color_step = 0
        else:
            self._color_step += amt + self._rainbowInc
            if self._color_step > len(colors.hue_rainbow) - 1:
                self._color_step = 0
    def step(self, amt=1):
        for j in range(0, self._num_segments):
            led_index = (j * self._segment_size) + self._current
            if self._individualPixel:
                # This setting will change the colour of each pixel on each cycle
                self._led.fill(colors.hue2rgb_rainbow(self._step), led_index,
                               led_index)
            else:
                # This setting will change the colour of all pixels on each cycle
                self._led.fill(colors.wheel_color(self._step), 0, led_index)

        if self._step == len(colors.hue_rainbow) - 1:
            self._step = 0
        else:
            self._step += amt

        if self._current == self._segment_size - 1:
            self._current = self._minLed
        else:
            self._current += amt
Ejemplo n.º 12
0
    def step(self, amt=1):
        self._color = colors.hue_helper(0, self._size, self._step)
        self._color = colors.hue2rgb_rainbow(
            (self._step * (256 / self._size)) % 256)

        super(LarsonRainbow, self).step(amt)
Ejemplo n.º 13
0
def wire():

    io = IOManager()
    #leds = LEDManager()
    ap = fft.AudioProcessor()

    driver = DriverLPD8806(160,c_order=ChannelOrder.RGB,use_py_spi=True,dev="/dev/spidev0.0",SPISpeed=16)
    ledmatrix = led.LEDMatrix(driver,width=20,height=8,threadedUpdate=True,rotation=1,serpentine=False)

    io.start_stream()

    update = 0
    count = 0.0

    while True:
        #This reads the data from the input stream 
        data = io.read()
    
        #This writes the data out to the hardware audio out port
        
        io.write(data)

        
        if len(data):
            brightness = ap.get_visualizer_array(data,io.chunk,io.rate)

            if update == 0:
                update = 10
            else:
                update = 0

            if int(count) >= int(255.0):
                count = 0.0
            else:
                count += .25
            
            """
            HORIZONTAL
            leds.fill(color=colors.hue2rgb_rainbow(int(count)),start=update*20,end=int((update*20+(brightness[update]*20))))
            leds.fill(color=(0,0,0),start=int(((update*20+(brightness[update]*20)))),end=(update* 20)+20)
            """

            ledmatrix.drawLine(x0=0,y0=int(update),x1=int(brightness[update]*7),y1=update,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update]*7),y0=update,x1=7,y1=update,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+1,x1=int(brightness[update+1]*8),y1=update+1,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+1]*8),y0=update+1,x1=8,y1=update+1,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+2,x1=int(brightness[update+2]*8),y1=update+2,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+2]*8),y0=update+2,x1=8,y1=update+2,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+3,x1=int(brightness[update+3]*7),y1=update+3,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+3]*8),y0=update+3,x1=8,y1=update+3,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+4,x1=int(brightness[update+4]*8),y1=update+4,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+4]*8),y0=update+4,x1=8,y1=update+4,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+5,x1=int(brightness[update+5]*8),y1=update+5,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+5]*8),y0=update+5,x1=8,y1=update+5,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+6,x1=int(brightness[update+6]*8),y1=update+6,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+6]*8),y0=update+6,x1=8,y1=update+6,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+7,x1=int(brightness[update+7]*8),y1=update+7,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+7]*8),y0=update+7,x1=8,y1=update+7,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+8,x1=int(brightness[update+8]*8),y1=update+8,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+8]*8),y0=update+8,x1=8,y1=update+8,color=(0,0,0))

            ledmatrix.drawLine(x0=0,y0=update+9,x1=int(brightness[update+9]*8),y1=update+9,color=colors.hue2rgb_rainbow(int(count)))
            ledmatrix.drawLine(x0=int(brightness[update+9]*8),y0=update+9,x1=8,y1=update+9,color=(0,0,0))

            ledmatrix.update()
        else:
        	ledmatrix.fillScreen(color=(0,0,0))