Once you've finished setting up your QT Py RP2040 with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.
To do this, click on the Download Project Bundle button in the window below. It will download to your computer as a zipped folder.
# SPDX-FileCopyrightText: 2023 Phil Burgess for Adafruit Industries # # SPDX-License-Identifier: MIT import math import time import board import adafruit_aw9523 GAMMA = 2.6 # For perceptually-linear brightness PINS = (15, 14, 13, 12, 7, 6, 5, 4) # List of pins, one per nOOd # Instantiate AW9523 on STEMMA I2C bus. This was tested on QT Py RP2040. # Other boards might require board.I2C() instead of board.STEMMA_I2C(). aw = adafruit_aw9523.AW9523(board.STEMMA_I2C()) for pin in PINS: aw.get_pin(pin).switch_to_output(value=True) # Activate pin, initialize OFF aw.LED_modes |= 1 << pin # Enable constant-current on pin while True: # Repeat forever... for i, pin in enumerate(PINS): # For each pin... # Calc sine wave, phase offset for each pin, with gamma correction. # If using red, green, blue nOOds, you'll get a cycle of hues. phase = (time.monotonic() - 2 * i / len(PINS)) * math.pi brightness = int((math.sin(phase) + 1.0) * 0.5 ** GAMMA * 255 + 0.5) aw.set_constant_current(pin, brightness)
Upload the Code and Libraries to the RP2040 Prop-Maker Feather
After downloading the Project Bundle, plug your QT Py RP2040 into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called CIRCUITPY. Unzip the folder and copy the following items to the QT Py RP2040's CIRCUITPY drive.
- lib folder
- code.py
Your QT Py RP2040 CIRCUITPY drive should look like this after copying the lib folder and the code.py file.
Text editor powered by tinymce.