#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 3
// For led chips like WS2812, 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
// Clock pin only needed for SPI based chipsets when not using hardware SPI
#define DATA_PIN 11 //資料連接腳位
#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
}
void loop() {
// Turn the LED on, then pause
leds[0] = CRGB::Red;
leds[1] = CRGB(255, 251, 0);
leds[2]=CRGB(7, 149, 36);
FastLED.show();
delay(500);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
FastLED.show();
delay(500);
for(int c=0;c<255;c=c+10){
leds[0] = CRGB(c, 5, 255-c);
leds[1] = CRGB(0, c, 0);
leds[2]=CRGB(c, c, 36);
FastLED.show();
delay(100);
}
}