You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
frommachineimportPinfromneopixelimportNeoPixelpin=Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixelsnp=NeoPixel(pin, 8) # create NeoPixel driver on GPIO0 for 8 pixelsnp[0] = (255, 255, 255) # set the first pixel to whitenp.write() # write data to all pixelsr, g, b=np[0] # get first pixel colour
The example gives a warning on the np[0] = (255, ...) line, because it can't find the __setitem__ method of the NeoPixel class.
The text was updated successfully, but these errors were encountered:
You are correct that the type stubs are incomplete here.
I'm aware of this and tracking it.
I'm doing a significant change to to add overloads to the stubs, and the fix to this will follow that one.
The code will run, but you may want to add a # type:ignore for now.
Please add your vote on the micropython-stub* repo to give me better visibility on these and other improvements on stubs, as i normally stop monitoring closed issues.
The NeoPixel example from the MicroPython rp2 docs is as follows:
The example gives a warning on the
np[0] = (255, ...)
line, because it can't find the__setitem__
method of theNeoPixel
class.The text was updated successfully, but these errors were encountered: