def __init__(self): # Create a NeoPixel object with 60 LEDs # and turn down the brightness self._strip=NeoPixel(60) self._strip.begin() self._strip.setBrightness(.25) self._strip.show()
def __init__(self, parent=None, **kwargs): super (Worker, self).__init__(parent, **kwargs) self._stop=False self._scheme=0 self._pattern=0 self._width=0 self._speed=0 self._neoPixel=NeoPixel(24) self._neoPixel.setBrightness(.4)
# ========== # # A C++ library for driving WS2812 RGB LED's (known as 'NeoPixels' by # # Adafruit) directly from a Raspberry Pi with accompanying Python wrapper # # Copyright (C) 2014 Rob Kent # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see <http://www.gnu.org/licenses/>. # # # ############################################################################### from NeoPixel import NeoPixel if __name__ == "__main__": n = NeoPixel(60) n.setBrightness(1.) n.effectsDemo() n.clear() n.show() del n exit(0)
if g < 0: g = 0 if b < 0: b = 0 c = Color() c.r = int(r * 255) c.g = int(g * 255) c.b = int(b * 255) return (c) # Creates a rainbow of all colors across all leds # The rainbow slides around once per minute if __name__ == "__main__": pixels = 27 # how many leds do you have. n = NeoPixel(pixels) n.setBrightness(1.) while (1): (fractionOfMinute, dummy) = modf(time() / 60.0) for i in range(0, pixels - 1): p = i / float(pixels) # 0.0..1.0 by position on string q = p + fractionOfMinute while (q > 1): q = q - 1.0 # normalize for overflow (r, g, b) = colorsys.hsv_to_rgb(q, 1.0, 1.0) n.setPixelColor(i, toNeoPixelColor(r, g, b)) n.show() sleep(0.2) n.clear() n.show() del n
#!/usr/bin/python from NeoPixel import NeoPixel if __name__=="__main__": n=NeoPixel(8) n.setBrightness(1.) n.effectsDemo() n.clear() n.show() del n exit(0)
def __init__(length): self.strip = NeoPixel(length)