本文整理匯總了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),
)
示例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)
示例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()
示例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)
示例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)
示例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)
示例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)
示例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)