FastLED 3.9.3
Loading...
Searching...
No Matches
Blink.ino
Go to the documentation of this file.
1
4
5#include <FastLED.h>
6
7// How many leds in your strip?
8#define NUM_LEDS 1
9
10// For led chips like WS2812, which have a data line, ground, and power, you just
11// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
12// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
13// Clock pin only needed for SPI based chipsets when not using hardware SPI
14#define DATA_PIN 3
15#define CLOCK_PIN 13
16
17// Define the array of leds
18CRGB leds[NUM_LEDS];
19
20void setup() {
21 // Uncomment/edit one of the following lines for your leds arrangement.
22 // ## Clockless types ##
23 FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
24 // FastLED.addLeds<SM16703, DATA_PIN, RGB>(leds, NUM_LEDS);
25 // FastLED.addLeds<TM1829, DATA_PIN, RGB>(leds, NUM_LEDS);
26 // FastLED.addLeds<TM1812, DATA_PIN, RGB>(leds, NUM_LEDS);
27 // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
28 // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
29 // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
30 // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
31 // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
32 // FastLED.addLeds<UCS1904, DATA_PIN, RGB>(leds, NUM_LEDS);
33 // FastLED.addLeds<UCS2903, DATA_PIN, RGB>(leds, NUM_LEDS);
34 // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
35 // FastLED.addLeds<WS2852, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
36 // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
37 // FastLED.addLeds<GS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
38 // FastLED.addLeds<SK6812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
39 // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS);
40 // FastLED.addLeds<APA106, DATA_PIN, RGB>(leds, NUM_LEDS);
41 // FastLED.addLeds<PL9823, DATA_PIN, RGB>(leds, NUM_LEDS);
42 // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS);
43 // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
44 // FastLED.addLeds<WS2813, DATA_PIN, RGB>(leds, NUM_LEDS);
45 // FastLED.addLeds<APA104, DATA_PIN, RGB>(leds, NUM_LEDS);
46 // FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS);
47 // FastLED.addLeds<GE8822, DATA_PIN, RGB>(leds, NUM_LEDS);
48 // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
49 // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
50 // FastLED.addLeds<LPD1886, DATA_PIN, RGB>(leds, NUM_LEDS);
51 // FastLED.addLeds<LPD1886_8BIT, DATA_PIN, RGB>(leds, NUM_LEDS);
52 // ## Clocked (SPI) types ##
53 // FastLED.addLeds<LPD6803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
54 // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
55 // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
56 // FastLED.addLeds<WS2803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
57 // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
58 // FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
59 // FastLED.addLeds<DOTSTAR, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
60 // FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
61 // FastLED.addLeds<SK9822, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
62}
63
64void loop() {
65 // Turn the LED on, then pause
66 leds[0] = CRGB::Red;
67 FastLED.show();
68 delay(500);
69 // Now turn the LED off, then pause
70 leds[0] = CRGB::Black;
71 FastLED.show();
72 delay(500);
73}
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:33
central include file for FastLED, defines the CFastLED class/object
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
Definition FastLED.cpp:82
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Definition FastLED.cpp:67
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:134
@ Red
Definition crgb.h:591
@ Black
Definition crgb.h:479
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:39