Description
import board
import neopixel
# Causes error
pixels = neopixel.NeoPixel(board.A15, 8, brightness=0.5)
# works fine
pixels = neopixel.NeoPixel(board.A15, 8, brightness=1.0)
pixels.brightness = 0.5
Setting brightness
to than 1.0
in NeoPixel()
causes the following error:
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "neopixel.py", line 131, in __init__
File "adafruit_pypixelbuf.py", line 103, in __init__
File "adafruit_pypixelbuf.py", line 187, in brightness
File "adafruit_pypixelbuf.py", line 206, in show
File "neopixel.py", line 167, in _transmit
AttributeError: 'NeoPixel' object has no attribute 'pin'
I believe this is attributed to self._transmit being called (referencing self.pin
) by pypixelbuf
as part of super().init, before self.pin
is initialised on line 135.
Tested with Adafruit CircuitPython 5.3.0 on 2020-04-29; stm32f411ce-blackpill with STM32F411CE
, CircuitPython bundle 5.x 20200526.