Skip to content

RGB LED

The nXPico M has a single WS2812 NeoPixel LED wired to GPIO23 (LED / NEOPIXEL).

The led module ships with the board firmware and provides a simple class with named color shortcuts.

from led import Led
rgb = Led()
rgb.red()
rgb.green()
rgb.blue()
rgb.white()
rgb.yellow()
rgb.cyan()
rgb.magenta()
rgb.orange()
rgb.off()

Pass an [r, g, b] list with values in the 0–255 range:

rgb.set_color([255, 128, 0]) # warm orange
print(rgb.get_value()) # e.g. [255, 128, 0]

See the Led API reference for full method details.

If you prefer to skip the wrapper:

import neopixel
from machine import Pin
np = neopixel.NeoPixel(Pin("NEOPIXEL"), 1)
np[0] = (255, 0, 0) # red
np.write()