Flash CircuitPython 9 (Alpha 5) on ESP32-C6, and control on-board RGB LED (NeoPixel).
Flash CircuitPython 9.0.0-alpha.5 on
YD-ESP32-C6-N16, and control on-board RGB LED (NeoPixel). Run on Windows 11.
esptool is needed to flash firmware on ESP-C6, read Install esptool on Windows 11.
Steps to flash CircuitPython firmware on ESP32-C6:
Visit https://circuitpython.org/downloads, search boards of ESP32-C6. There are no 16MB Flash version, so I try "ESP32-C6-DevKitC-1-N8". Download .bin of CircuitPython 9.0.0-alpha.5 now.
Connect to USB connector marked "COM".
Erase Flash with command:
esptool --chip esp32c6 --port <COM> erase_flash
Write Binary Data to Flash with command:
esptool --chip esp32c6 --port <COM> write_flash 0x0 <.bin>
Reconect USB to connector marked "USB".Open Thonny Python IDE.
In Thonny:
> Run > Configure interpreter...
Select interpreter of "CircuitPython (generic)" and Port, then OK.
Prepare lib for neopixel:
Visit https://circuitpython.org/libraries, to download Library Bundle for Version 9.x.
> Run > Configure interpreter...
Select interpreter of "CircuitPython (generic)" and Port, then OK.
Prepare lib for neopixel:
Visit https://circuitpython.org/libraries, to download Library Bundle for Version 9.x.
Extract the downloaded file.
Upload the neopixel.mpy to CircuitPython device /lib folder.
Code:
Run my CircuitPython NeoPixel exercise, cpyC6_NEOPIXEL.py.
Code:
Run my CircuitPython NeoPixel exercise, cpyC6_NEOPIXEL.py.
import time
import neopixel
import board
import sys, os
def cycleNeopixel(wait):
print("RED")
for r in range(255):
pixel[0] = (r, 0, 0)
time.sleep(wait)
for r in range(255, 0, -1):
pixel[0] = (r, 0, 0)
time.sleep(wait)
print("GREEN")
for g in range(255):
pixel[0] = (0, g, 0)
time.sleep(wait)
for g in range(255, 0, -1):
pixel[0] = (0, g, 0)
time.sleep(wait)
print("BLUE")
for b in range(255):
pixel[0] = (0, 0, b)
time.sleep(wait)
for b in range(255, 0, -1):
pixel[0] = (0, 0, b)
time.sleep(wait)
print("=========================================")
print("CircuitPython NeoPixel exercise")
print("to control onboard RGB NeoPixel")
print("-----------------------------------------")
print(sys.implementation[0], os.uname()[3],
"\nrun on", os.uname()[4])
print(neopixel.__name__, neopixel.__version__)
print("board.NEOPIXEL: ", board.NEOPIXEL)
print("=========================================")
print()
# Create the NeoPixel object
pixel = neopixel.NeoPixel(board.NEOPIXEL,
1,
pixel_order=neopixel.GRB)
pixel[0] = (0, 0, 0)
time.sleep(2.0)
cycleNeopixel(0.005)
pixel[0] = (0, 0, 0)
time.sleep(2.0)
print("- bye -\n")
Comments
Post a Comment