Python neopixel.GRB Examples
The following are 9
code examples of neopixel.GRB().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
neopixel
, or try the search function
.
Example #1
Source File: clue.py From Adafruit_CircuitPython_PyBadger with MIT License | 8 votes |
def __init__(self): super().__init__() i2c = board.I2C() if i2c is not None: self._accelerometer = adafruit_lsm6ds.LSM6DS33(i2c) # NeoPixels self._neopixels = neopixel.NeoPixel( board.NEOPIXEL, self._neopixel_count, brightness=1, pixel_order=neopixel.GRB ) self._buttons = GamePad( digitalio.DigitalInOut(board.BUTTON_A), digitalio.DigitalInOut(board.BUTTON_B), )
Example #2
Source File: neopixel_rpi_simpletest.py From Adafruit_CircuitPython_NeoPixel with MIT License | 6 votes |
def wheel(pos): # Input a value 0 to 255 to get a color value. # The colours are a transition r - g - b - back to r. if pos < 0 or pos > 255: r = g = b = 0 elif pos < 85: r = int(pos * 3) g = int(255 - pos * 3) b = 0 elif pos < 170: pos -= 85 r = int(255 - pos * 3) g = 0 b = int(pos * 3) else: pos -= 170 r = 0 g = int(pos * 3) b = int(255 - pos * 3) return (r, g, b) if ORDER in (neopixel.RGB, neopixel.GRB) else (r, g, b, 0)
Example #3
Source File: neopixel_simpletest.py From Adafruit_CircuitPython_NeoPixel with MIT License | 6 votes |
def wheel(pos): # Input a value 0 to 255 to get a color value. # The colours are a transition r - g - b - back to r. if pos < 0 or pos > 255: r = g = b = 0 elif pos < 85: r = int(pos * 3) g = int(255 - pos * 3) b = 0 elif pos < 170: pos -= 85 r = int(255 - pos * 3) g = 0 b = int(pos * 3) else: pos -= 170 r = 0 g = int(pos * 3) b = int(255 - pos * 3) return (r, g, b) if ORDER in (neopixel.RGB, neopixel.GRB) else (r, g, b, 0)
Example #4
Source File: Simple_LED_Connector.py From Hector9000 with MIT License | 6 votes |
def __init__(self): self.PORT = board.D18 self.NUM = 15 self.NUMBASE = 5 self.pixels = neopixel.NeoPixel(self.PORT, self.NUM) self.cols = [ (255, 0, 0), (255, 63, 0), (255, 120, 0), (0, 255, 0), (0, 255, 255), (0, 0, 255), (255, 0, 255) ] self.col_neutral = (80, 80, 30) self.NUMCOLS = len(self.cols) self.mode = 1 self.ORDER = neopixel.GRB self.num_pixels = self.NUM self.pixels.fill(self.col_neutral) self.drinkcolor = (0,0,0) self.thr = threading.Thread(target=self.mode3, args=()) self.thr.start()
Example #5
Source File: LEDStripConnector.py From Hector9000 with MIT License | 6 votes |
def __init__(self): self.PORT = board.D18 self.NUM = 15 self.NUMBASE = 5 self.pixels = neopixel.NeoPixel(self.PORT, self.NUM) self.cols = [ (255, 0, 0), (255, 63, 0), (255, 120, 0), (0, 255, 0), (0, 255, 255), (0, 0, 255), (255, 0, 255) ] self.col_neutral = (80, 80, 30) self.NUMCOLS = len(self.cols) self.mode = 1 self.ORDER = neopixel.GRB self.num_pixels = self.NUM self.pixels.fill(self.col_neutral) self.drinkcolor = (0,0,0)
Example #6
Source File: LEDStripConnector.py From Hector9000 with MIT License | 6 votes |
def wheel(self, pos): if pos < 0 or pos > 255: r = g = b = 0 elif pos < 85: r = int(pos * 3) g = int(255 - pos * 3) b = 0 elif pos < 170: pos -= 85 r = int(255 - pos * 3) g = 0 b = int(pos * 3) else: pos -= 170 r = 0 g = int(pos * 3) b = int(255 - pos * 3) return (r, g, b) if ORDER == neopixel.RGB or ORDER == neopixel.GRB else (r, g, b, 0)
Example #7
Source File: pybadge.py From Adafruit_CircuitPython_PyBadger with MIT License | 5 votes |
def __init__(self): super().__init__() i2c = None if i2c is None: try: i2c = board.I2C() except RuntimeError: self._accelerometer = None if i2c is not None: int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT) try: self._accelerometer = adafruit_lis3dh.LIS3DH_I2C( i2c, address=0x19, int1=int1 ) except ValueError: self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1) # NeoPixels self._neopixels = neopixel.NeoPixel( board.NEOPIXEL, self._neopixel_count, brightness=1, pixel_order=neopixel.GRB ) self._buttons = GamePadShift( digitalio.DigitalInOut(board.BUTTON_CLOCK), digitalio.DigitalInOut(board.BUTTON_OUT), digitalio.DigitalInOut(board.BUTTON_LATCH), ) self._light_sensor = analogio.AnalogIn(board.A7)
Example #8
Source File: pygamer.py From Adafruit_CircuitPython_PyBadger with MIT License | 5 votes |
def __init__(self): super().__init__() i2c = board.I2C() int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT) try: self._accelerometer = adafruit_lis3dh.LIS3DH_I2C( i2c, address=0x19, int1=int1 ) except ValueError: self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1) # NeoPixels self._neopixels = neopixel.NeoPixel( board.NEOPIXEL, self._neopixel_count, brightness=1, pixel_order=neopixel.GRB ) self._buttons = GamePadShift( digitalio.DigitalInOut(board.BUTTON_CLOCK), digitalio.DigitalInOut(board.BUTTON_OUT), digitalio.DigitalInOut(board.BUTTON_LATCH), ) self._pygamer_joystick_x = analogio.AnalogIn(board.JOYSTICK_X) self._pygamer_joystick_y = analogio.AnalogIn(board.JOYSTICK_Y) self._light_sensor = analogio.AnalogIn(board.A7)
Example #9
Source File: pyportal.py From Adafruit_CircuitPython_PyBadger with MIT License | 4 votes |
def __init__(self): super().__init__() # NeoPixels self._neopixels = neopixel.NeoPixel( board.NEOPIXEL, self._neopixel_count, brightness=1, pixel_order=neopixel.GRB ) self._light_sensor = analogio.AnalogIn(board.LIGHT)