Skip to content

MacroPad RP2040 NeoPixel LEDs

MacroPad neopixel strip

adafruit-macropad-rp2040-pinout

You can buy MacroPad on the official Adafruit store.

This blog post will allow you to control MacroPad switches LEDs.

code.py
from adafruit_macropad import MacroPad
import time
macropad = MacroPad()
NUM_LEDS = 12
# Initialize NeoPixel strip
# strip = neopixel.NeoPixel(PIN, NUM_LEDS, brightness=BRIGHTNESS, auto_write=False)
def set_pixel(pixel_number, red, green, blue):
if 0 <= pixel_number < NUM_LEDS:
macropad.pixels[pixel_number] = (red, green, blue)
def color_wipe(red, green, blue, delay_time):
for i in range(NUM_LEDS):
set_pixel(i, red, green, blue)
time.sleep(delay_time)
def reverse_color_wipe(red, green, blue, delay_time):
for i in range(NUM_LEDS-1, -1, -1):
set_pixel(i, red, green, blue)
time.sleep(delay_time)
# Main loop
while True:
color_wipe(220, 44, 0, 0.1)
color_wipe(48, 79, 255, 0.1)
color_wipe(0, 191, 165, 0.1)
reverse_color_wipe(220, 44, 0, 0.1)
reverse_color_wipe(48, 79, 255, 0.1)
reverse_color_wipe(0, 191, 165, 0.1)

πŸ“‚ adafruit/macropad-rp2040/neopixel/color-wipe/code.pyView on GitLab β†—

The effects I wrote for the MacroPad are:

  • Color Wipe
  • Meteor Rain
  • Rainbow Cycle