Here's a simple example showing how to blink the on board NeoPixel of either the Feather ESP32 V2 or the QT PY ESP32 Pico. It covers addings a library file, neopixel.mpy, as well as editting code.py directly in the browser.

Adding a Library File

Follow these steps to add neopixel.mpy to the /lib folder.

From the main Welcome! screen, click on the file browser link.

Now click the lib folder link to navigate into the /lib folder.

We need to navigate first, since uploaded files will go into the current directory location.

Now click the first Browse... button (for files) to bring up a file explorer window.

Navigate to where you've downloaded the CircuitPython Library Bundle and select the neopixel.mpy file.

Then click OK, or Open, or whatever your file window shows.

After uploading, the neopixel.mpy file will be shown in the /lib folder.

Edit code.py

Follow these steps to write a simple NeoPixel blink example and save it as code.py so it will run automatically.

From the previous step, click the two little .. to go back up one level in the folders.

Now click the Edit button on the code.py line.

Here's the simple example code used:

import time
import board
import neopixel

pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)

while True:
    pixels.fill(0xADAF00)
    time.sleep(1)
    pixels.fill(0)
    time.sleep(1)

Replace the contents of code.py with the code listing shown (can copy from above).

Make sure it matches what is shown - no indent errors, etc. Then click the Save button.

The page will remain, but the status code should change.

At this point the code should be running and the onboard NeoPixel should be blinking.

There may be a small delay after hitting the Save button before the could actually runs.

This guide was first published on Aug 18, 2022. It was last updated on Apr 01, 2024.

This page (NeoPixel Example) was last updated on Mar 08, 2024.

Text editor powered by tinymce.