Hi, ich bin noch ein ziehmlicher Anfänger was Arduino angeht, dennoch wollte ich mich mal an Neopixel heranwagen. Dazu habe ich ein Beispielprogramm "Cylon" genommen und habe es soweit es geht meinen Vorstellungen angepasst. Wo ich nicht weiterkomme ist, wie ich die Farbe des Lauflichts definieren kann.
Man kann wohl im "Void Setup" die Reihenfolge von RGB/BGR oder GBR anpassen, allerdings kann man da nur die Grundfarben einstellen (jeweils der Buchstabe, der in der mitte steht ist ausschlaggebend).
Hier der Code:
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 300
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 7
#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(57600);
Serial.println("resetting");
LEDS.addLeds<WS2812B,DATA_PIN, GRB > (leds,NUM_LEDS);
LEDS.setBrightness(255);
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(220); } }
void loop() {
static uint8_t hue = 0;
Serial.print("x");
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CHSV(0, 255, 200);
CRGB(255, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(1);
}
Serial.print("x");
}
Schonmal vielen Dank im Voraus!