當前位置: 首頁>>代碼示例>>Python>>正文


Python neopixel.GRB屬性代碼示例

本文整理匯總了Python中neopixel.GRB屬性的典型用法代碼示例。如果您正苦於以下問題:Python neopixel.GRB屬性的具體用法?Python neopixel.GRB怎麽用?Python neopixel.GRB使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在neopixel的用法示例。


在下文中一共展示了neopixel.GRB屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __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

示例2: 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

示例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;未經允許,請勿轉載。