LED-Ring mit 8x WS2812-LEDs
| Pin | Signal | Beschreibung |
|---|---|---|
DI |
data | Data IN |
5V |
power | VCC 5V |
GND |
ground | GND |
DO |
data | Data OUT |
| Von | Nach | Kabel |
|---|---|---|
board:5V |
x1:5V |
red |
board:GND |
x1:GND |
black |
board:D6 |
x1:DI |
green |
Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.
// Canonical beginner example for a WS2812 LED Ring 8-bit
// This sketch lights the 8 LEDs one at a time in a simple chase pattern.
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUMPIXELS 8
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin();
pixels.clear();
pixels.show();
}
void loop() {
// Chase a single red LED around the ring
for (int i = 0; i < NUMPIXELS; i++) {
pixels.clear();
pixels.setPixelColor(i, pixels.Color(255, 0, 0));
pixels.show();
delay(150);
}
// Turn all LEDs off briefly between cycles
pixels.clear();
pixels.show();
delay(300);
}
Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.
Kostenlos starten