Display solid colour on built-in neopixel LED

Display solid colour on built-in neopixel LED

Main Diagram

Hardware Required

  • PICUNO Microcontroller board (built-in NeoPixel LED on GPIO 17)
  • USB cable (for power and programming)

Description

The program initializes the NeoPixel with one LED connected to GPIO 17. It sets the brightness and sends the colour red to the LED. Once the colour is written, the LED glows steadily with that colour until the program changes it or the board is reset. You can modify the RGB values to display any other colour. Some of them are given in the code.

Circuit Diagram

Circuit

  • Connect the PICUNO board to the computer using a USB cable.
  • No external wires or breadboard are required.
  • The built-in NeoPixel is already wired to GPIO 17.
  • The Arduino sketch uses the Adafruit NeoPixel library for control.
  • The Thonny IDE uses picuno library for control.

Schematic

This project uses the built-in LED on GPIO 14 of the PicUNO board. No additional circuit components are required.

Code - C

#include <Adafruit_NeoPixel.h>

#define PIN 17       // GPIO 17
#define NUMPIXELS 1  // One built-in NeoPixel

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();        // Initialize NeoPixel
  pixels.setBrightness(50); // Set brightness (0-255)
  pixels.setPixelColor(0, pixels.Color(255, 0, 0)); // Set to RED
  pixels.show();         // Send the color to LED
}

void loop() {
  // Do nothing, LED stays red
}
Color Examples:
#green → (0, 255, 0)
#blue → (0, 0, 255)
#yellow → (255, 150, 0)
#white → (255, 255, 255)
Adafruit_NeoPixel() - Creates NeoPixel object for 1 LED.

setBrightness(50) - Adjusts LED brightness.

setPixelColor(0, pixels.Color(255, 0, 0)) - Sets LED to red.

pixels.show() - Updates the LED with set color.

Code - Micropython

from picuno import Neopixel
import time

# Setup 1 NeoPixel on GPIO 17 with GRB color order
pixels = Neopixel(1, 0, 17, "GRB")

# Set brightness (0 to 100%)
pixels.brightness(50)

# Set solid color to RED
pixels.set_pixel(0, (255, 0, 0))
pixels.show()
Color Examples:
#green → (0, 255, 0)
#blue → (0, 0, 255)
#yellow → (255, 150, 0)
#white → (255, 255, 255)
Neopixel(1, 0, 17, "GRB") - Initializes 1 NeoPixel on GPIO 17 using GRB format.

brightness(50) - Sets the LED brightness to 50%.

set_pixel(0, (255, 0, 0)) - Assigns red color to LED 0.

show() - Sends the color data to apply.