LED coding QT PY esp32-s2

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
helidude135
 
Posts: 8
Joined: Sat Oct 01, 2022 2:52 pm

LED coding QT PY esp32-s2

Post by helidude135 »

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)

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: LED coding QT PY esp32-s2

Post by mikeysklar »

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.

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)
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.
RED blinks: Code ended due to an exception. Check the serial console for details.
https://learn.adafruit.com/adafruit-qt- ... er-2978455

User avatar
helidude135
 
Posts: 8
Joined: Sat Oct 01, 2022 2:52 pm

Re: LED coding QT PY esp32-s2

Post by helidude135 »

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.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: LED coding QT PY esp32-s2

Post by mikeysklar »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”