Hello,
I'm new to coding, when trying to code the led function on the QT PY esp32-s2 on Mu by using the code below the LED blinks red two times every 5 seconds. Which I think its suppose to be blinking every half second. Changing the time interval does nothing to change the speed either. I have the pixlebuf and noepixel files in the library as well. Some help would be great to know where I'm going wrong.
Thanks.
import time
import board
import neopixel
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)
while True:
pixels.fill((255, 0, 0))
time.sleep(0.5)
pixels.fill((0, 0, 0))
time.sleep(0.5)
LED coding QT PY esp32-s2
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: LED coding QT PY esp32-s2
A few things to try here:
1) Try switching the LED color from red to blue so we don't confused a possible syntax error with your blink code.
2) Make sure you are using the appropriate white space or your code will not loop. I cannot tell from how you pasted the CODE without tags if you have the spaces/tabs necessary for your code to execute.
3) Open the REPL console from the Mu Editor and see if there are any error messages.
1) Try switching the LED color from red to blue so we don't confused a possible syntax error with your blink code.
Code: Select all
import time
import board
import neopixel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
while True:
pixel.fill((0, 0, 255)) # <---- I changed this line for a blue blink
time.sleep(0.5)
pixel.fill((0, 0, 0))
time.sleep(0.5)
3) Open the REPL console from the Mu Editor and see if there are any error messages.
https://learn.adafruit.com/adafruit-qt- ... er-2978455RED blinks: Code ended due to an exception. Check the serial console for details.
- helidude135
- Posts: 8
- Joined: Sat Oct 01, 2022 2:52 pm
Re: LED coding QT PY esp32-s2
I tried running your code and light stayed red. Tried messing with the spacing, no change.
This is what it says in the REPL:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 3, in <module>
File "adafruit_seesaw/neopixel.py", line 25, in <module>
ImportError: seesaw neopixel being imported from unexpected location - is seesaw neopixel use intended?
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
This is what it says in the REPL:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 3, in <module>
File "adafruit_seesaw/neopixel.py", line 25, in <module>
ImportError: seesaw neopixel being imported from unexpected location - is seesaw neopixel use intended?
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: LED coding QT PY esp32-s2
Please verify that you have followed the instructions with the blink code and placed the following onto your Qt Py CIRCUITPY/lib folder:
* neopixel.mpy
* adafruit_pixelbuf.mpy
You can get the above two files from the CircuitPython 7.x Bundle (MPY version).
https://circuitpython.org/libraries
* neopixel.mpy
* adafruit_pixelbuf.mpy
You can get the above two files from the CircuitPython 7.x Bundle (MPY version).
https://circuitpython.org/libraries
Please be positive and constructive with your questions and comments.