FastLED 3.10.8
Loading...
Searching...
No Matches
Blink.ino
Go to the documentation of this file.
1
4
5#include <Arduino.h>
6#include <FastLED.h>
7
8// How many leds in your strip?
9#define NUM_LEDS 1
10
11// For led chips like WS2812, which have a data line, ground, and power, you just
12// need to define PIN_DATA. For led chipsets that are SPI based (four wires - data, clock,
13// ground, and power), like the LPD8806 define both PIN_DATA and CLOCK_PIN
14// Clock pin only needed for SPI based chipsets when not using hardware SPI
15#ifndef PIN_DATA
16#define PIN_DATA FL_PIN_CLOCKLESS_1
17#endif // PIN_DATA
18
19#define CLOCK_PIN 13
20
21// Define the array of leds
23
24void setup() {
25 // Uncomment/edit one of the following lines for your leds arrangement.
26 // ## Clockless types ##
27 FastLED.addLeds<NEOPIXEL, PIN_DATA>(leds, NUM_LEDS); // GRB ordering is assumed
28
29 // FastLED.addLeds<SM16824E, PIN_DATA, RGB>(leds, NUM_LEDS); // RGB ordering (uses SM16824EController)
30 // FastLED.addLeds<SM16703, PIN_DATA, RGB>(leds, NUM_LEDS);
31 // FastLED.addLeds<TM1829, PIN_DATA, RGB>(leds, NUM_LEDS);
32 // FastLED.addLeds<TM1812, PIN_DATA, RGB>(leds, NUM_LEDS);
33 // FastLED.addLeds<TM1809, PIN_DATA, RGB>(leds, NUM_LEDS);
34 // FastLED.addLeds<TM1804, PIN_DATA, RGB>(leds, NUM_LEDS);
35 // FastLED.addLeds<TM1803, PIN_DATA, RGB>(leds, NUM_LEDS);
36 // FastLED.addLeds<UCS1903, PIN_DATA, RGB>(leds, NUM_LEDS);
37 // FastLED.addLeds<UCS1903B, PIN_DATA, RGB>(leds, NUM_LEDS);
38 // FastLED.addLeds<UCS1904, PIN_DATA, RGB>(leds, NUM_LEDS);
39 // FastLED.addLeds<UCS2903, PIN_DATA, RGB>(leds, NUM_LEDS);
40 // FastLED.addLeds<UCS7604, PIN_DATA, GRB>(leds, NUM_LEDS); // 8-bit RGBW chipset (all platforms)
41 // FastLED.addLeds<UCS7604HD, PIN_DATA, GRB>(leds, NUM_LEDS); // 16-bit RGBW chipset (all platforms)
42 // FastLED.addLeds<WS2812, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
43 // FastLED.addLeds<WS2852, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
44 // FastLED.addLeds<WS2812B, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
45 // FastLED.addLeds<WS2812BV5, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical (newer V5 variant with tighter timing)
46 // FastLED.addLeds<WS2812BMiniV3, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical (same timing as V5)
47 // FastLED.addLeds<GS1903, PIN_DATA, RGB>(leds, NUM_LEDS);
48 // FastLED.addLeds<SK6812, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
49 // FastLED.addLeds<LC8816E, PIN_DATA, GRB>(leds, NUM_LEDS); // 12V GRBW; RGBW enabled automatically
50 // FastLED.addLeds<SK6822, PIN_DATA, RGB>(leds, NUM_LEDS);
51 // FastLED.addLeds<APA106, PIN_DATA, RGB>(leds, NUM_LEDS);
52 // FastLED.addLeds<PL9823, PIN_DATA, RGB>(leds, NUM_LEDS);
53 // FastLED.addLeds<SK6822, PIN_DATA, RGB>(leds, NUM_LEDS);
54 // FastLED.addLeds<WS2811, PIN_DATA, RGB>(leds, NUM_LEDS);
55 // FastLED.addLeds<WS2813, PIN_DATA, RGB>(leds, NUM_LEDS);
56 // FastLED.addLeds<APA104, PIN_DATA, RGB>(leds, NUM_LEDS);
57 // FastLED.addLeds<WS2811_400, PIN_DATA, RGB>(leds, NUM_LEDS);
58 // FastLED.addLeds<GE8822, PIN_DATA, RGB>(leds, NUM_LEDS);
59 // FastLED.addLeds<GW6205, PIN_DATA, RGB>(leds, NUM_LEDS);
60 // FastLED.addLeds<GW6205_400, PIN_DATA, RGB>(leds, NUM_LEDS);
61 // FastLED.addLeds<LPD1886, PIN_DATA, RGB>(leds, NUM_LEDS);
62 // FastLED.addLeds<LPD1886_8BIT, PIN_DATA, RGB>(leds, NUM_LEDS);
63 // ## Clocked (SPI) types ##
64 // FastLED.addLeds<LPD6803, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
65 // FastLED.addLeds<LPD8806, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
66 // FastLED.addLeds<WS2801, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS);
67 // FastLED.addLeds<WS2803, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS);
68 // FastLED.addLeds<SM16716, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS);
69 // FastLED.addLeds<MY9221, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // 4 RGB LEDs per chip
70 // FastLED.addLeds<P9813, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
71 // FastLED.addLeds<DOTSTAR, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
72 // FastLED.addLeds<APA102, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
73 // FastLED.addLeds<SK9822, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
74}
75
76void loop() {
77 // Turn the LED on, then pause
78 for (int i = 0; i < NUM_LEDS; ++i) {
79 leds[i] = CRGB::Red;
80 }
81 FastLED.show();
82 delay(500);
83
84 // Now turn the LED off, then pause
85 for (int i = 0; i < NUM_LEDS; ++i) {
86 leds[i] = CRGB::Black;
87 }
88 FastLED.show();
89 delay(100);
90}
CRGB leds[1]
void setup()
void loop()
#define NUM_LEDS
#define PIN_DATA
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::CRGB CRGB
Definition crgb.h:25
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition crgb.h:629
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:517