Closed pvanallen closed 6 years ago
neopixel
is initialised in the Circuit Playground Express cpx
lib, so you can't import both. If you want to use NeoPixels with the cpx
lib, try using cpx.pixels
. Otherwise, you'll need to use the individual libraries you wish to use to be able to use neopixel
separately.
Ah, got it, thanks. Sorry, I was referencing this code which I guess is out of date now.
For completeness, working code:
import time
from adafruit_circuitplayground.express import cpx
cpx.pixels.brightness = 0.3
cpx.pixels.fill((127, 0, 0))
cpx.pixels.show()
while True:
x, y, z = cpx.acceleration
print(x, y, z)
time.sleep(0.1)
Also, this Adafruit example uses the same approach combining cpx and neopixel libs and doesn't work. It would be good to get that updated:
https://learn.adafruit.com/ufo-circuit-playground-express/code-the-ufo-with-circuitpython
@pvanallen There is a feedback link on the guide page, if you could leave the feedback there regarding the code, that would be greatly appreciated!
Yes, saw that after my post and commented a few minutes ago, referencing this issue.
Hello,
I just ran into this same issue while trying to leverage the code on this adafruit guide. https://learn.adafruit.com/circuitplayground-morse-code-flasher-makecode-circuit-python/circuitpython
I submitted some feedback on the website itself already but in case anyone else runs in this issue, here is what I did (special thanks to Kattni above who suggested this):
pixels = cpx.pixels
pixels.fill((0, 0, 0))
pixels.show()
This code produces an error. With release adafruit-circuitpython-circuitplayground_express-3.0.0.uf2