The Adafruit NeoPixel Shield is an Arduino-compatible shield designed to effortlessly control a grid of NeoPixel LEDs. NeoPixels, which are individually addressable RGB LEDs, are popular for creating vibrant and complex lighting displays. The shield simplifies the process of wiring and controlling these LEDs by providing a ready-to-use platform that can be directly mounted onto an Arduino or compatible microcontroller board.
Pin Number | Description |
---|---|
D6 | Data input for NeoPixel LEDs |
5V | Power supply voltage (5V) |
GND | Ground connection |
#include <Adafruit_NeoPixel.h>
#define PIN 6 // Pin connected to NeoPixel data input
#define NUMPIXELS 40 // Number of NeoPixels on the shield
// Initialize the NeoPixel shield
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin(); // Initialize the NeoPixel shield
}
void loop() {
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(150, 0, 0)); // Set color to red
pixels.show(); // Update the LEDs
delay(50);
pixels.setPixelColor(i, pixels.Color(0, 0, 0)); // Turn off the LED
}
}
Q: Can I chain multiple NeoPixel Shields together? A: Yes, you can connect multiple shields in series, but ensure your power supply can handle the increased current draw.
Q: How do I control individual LEDs?
A: Use the setPixelColor
function with the index of the LED you wish to control.
Q: What is the maximum number of LEDs I can control with one Arduino? A: It depends on the Arduino's RAM. Each LED requires some memory to store its color value. With the Arduino Uno, you can control thousands of LEDs, but power and processing speed may become limiting factors.