当前位置: 首页>>代码示例>>Python>>正文


Python neopixel.GRB属性代码示例

本文整理汇总了Python中neopixel.GRB属性的典型用法代码示例。如果您正苦于以下问题:Python neopixel.GRB属性的具体用法?Python neopixel.GRB怎么用?Python neopixel.GRB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在neopixel的用法示例。


在下文中一共展示了neopixel.GRB属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wheel

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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) 
开发者ID:adafruit,项目名称:Adafruit_CircuitPython_NeoPixel,代码行数:22,代码来源:neopixel_rpi_simpletest.py

示例2: __init__

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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),
        ) 
开发者ID:adafruit,项目名称:Adafruit_CircuitPython_PyBadger,代码行数:19,代码来源:clue.py

示例3: __init__

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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() 
开发者ID:H3c702,项目名称:Hector9000,代码行数:25,代码来源:Simple_LED_Connector.py

示例4: __init__

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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) 
开发者ID:H3c702,项目名称:Hector9000,代码行数:23,代码来源:LEDStripConnector.py

示例5: wheel

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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) 
开发者ID:H3c702,项目名称:Hector9000,代码行数:20,代码来源:LEDStripConnector.py

示例6: __init__

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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) 
开发者ID:adafruit,项目名称:Adafruit_CircuitPython_PyBadger,代码行数:34,代码来源:pybadge.py

示例7: __init__

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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) 
开发者ID:adafruit,项目名称:Adafruit_CircuitPython_PyBadger,代码行数:30,代码来源:pygamer.py

示例8: __init__

# 需要导入模块: import neopixel [as 别名]
# 或者: from neopixel import GRB [as 别名]
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) 
开发者ID:adafruit,项目名称:Adafruit_CircuitPython_PyBadger,代码行数:10,代码来源:pyportal.py


注:本文中的neopixel.GRB属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。