FastLED
3.9.15
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 3
17
#endif
// PIN_DATA
18
19
#define CLOCK_PIN 13
20
21
// Define the array of leds
22
CRGB
leds
[
NUM_LEDS
];
23
24
void
setup
() {
25
Serial
.begin(115200);
26
Serial
.println(
"\n=============================================="
);
27
Serial
.println(
" BLINK.INO - Simple LED Blink Example"
);
28
Serial
.println(
"==============================================\n"
);
29
30
// Uncomment/edit one of the following lines for your leds arrangement.
31
// ## Clockless types ##
32
FastLED
.addLeds<NEOPIXEL,
PIN_DATA
>(
leds
,
NUM_LEDS
);
// GRB ordering is assumed
33
34
Serial
.println(
"✓ Blink setup complete - starting blink loop\n"
);
35
// FastLED.addLeds<SM16824E, PIN_DATA, RGB>(leds, NUM_LEDS); // RGB ordering (uses SM16824EController)
36
// FastLED.addLeds<SM16703, PIN_DATA, RGB>(leds, NUM_LEDS);
37
// FastLED.addLeds<TM1829, PIN_DATA, RGB>(leds, NUM_LEDS);
38
// FastLED.addLeds<TM1812, PIN_DATA, RGB>(leds, NUM_LEDS);
39
// FastLED.addLeds<TM1809, PIN_DATA, RGB>(leds, NUM_LEDS);
40
// FastLED.addLeds<TM1804, PIN_DATA, RGB>(leds, NUM_LEDS);
41
// FastLED.addLeds<TM1803, PIN_DATA, RGB>(leds, NUM_LEDS);
42
// FastLED.addLeds<UCS1903, PIN_DATA, RGB>(leds, NUM_LEDS);
43
// FastLED.addLeds<UCS1903B, PIN_DATA, RGB>(leds, NUM_LEDS);
44
// FastLED.addLeds<UCS1904, PIN_DATA, RGB>(leds, NUM_LEDS);
45
// FastLED.addLeds<UCS2903, PIN_DATA, RGB>(leds, NUM_LEDS);
46
// FastLED.addLeds<UCS7604, PIN_DATA, GRB>(leds, NUM_LEDS); // 8-bit RGBW chipset (all platforms)
47
// FastLED.addLeds<UCS7604HD, PIN_DATA, GRB>(leds, NUM_LEDS); // 16-bit RGBW chipset (all platforms)
48
// FastLED.addLeds<WS2812, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
49
// FastLED.addLeds<WS2852, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
50
// FastLED.addLeds<WS2812B, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
51
// FastLED.addLeds<WS2812BV5, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical (newer V5 variant with tighter timing)
52
// FastLED.addLeds<WS2812BMiniV3, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical (same timing as V5)
53
// FastLED.addLeds<GS1903, PIN_DATA, RGB>(leds, NUM_LEDS);
54
// FastLED.addLeds<SK6812, PIN_DATA, RGB>(leds, NUM_LEDS); // GRB ordering is typical
55
// FastLED.addLeds<SK6822, PIN_DATA, RGB>(leds, NUM_LEDS);
56
// FastLED.addLeds<APA106, PIN_DATA, RGB>(leds, NUM_LEDS);
57
// FastLED.addLeds<PL9823, PIN_DATA, RGB>(leds, NUM_LEDS);
58
// FastLED.addLeds<SK6822, PIN_DATA, RGB>(leds, NUM_LEDS);
59
// FastLED.addLeds<WS2811, PIN_DATA, RGB>(leds, NUM_LEDS);
60
// FastLED.addLeds<WS2813, PIN_DATA, RGB>(leds, NUM_LEDS);
61
// FastLED.addLeds<APA104, PIN_DATA, RGB>(leds, NUM_LEDS);
62
// FastLED.addLeds<WS2811_400, PIN_DATA, RGB>(leds, NUM_LEDS);
63
// FastLED.addLeds<GE8822, PIN_DATA, RGB>(leds, NUM_LEDS);
64
// FastLED.addLeds<GW6205, PIN_DATA, RGB>(leds, NUM_LEDS);
65
// FastLED.addLeds<GW6205_400, PIN_DATA, RGB>(leds, NUM_LEDS);
66
// FastLED.addLeds<LPD1886, PIN_DATA, RGB>(leds, NUM_LEDS);
67
// FastLED.addLeds<LPD1886_8BIT, PIN_DATA, RGB>(leds, NUM_LEDS);
68
// ## Clocked (SPI) types ##
69
// FastLED.addLeds<LPD6803, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
70
// FastLED.addLeds<LPD8806, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
71
// FastLED.addLeds<WS2801, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS);
72
// FastLED.addLeds<WS2803, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS);
73
// FastLED.addLeds<SM16716, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS);
74
// FastLED.addLeds<P9813, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
75
// FastLED.addLeds<DOTSTAR, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
76
// FastLED.addLeds<APA102, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
77
// FastLED.addLeds<SK9822, PIN_DATA, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical
78
}
79
80
void
loop
() {
81
// Turn the LED on, then pause
82
for
(
int
i = 0; i <
NUM_LEDS
; ++i) {
83
leds
[i] =
CRGB::Red
;
84
}
85
FastLED
.show();
86
delay(500);
87
88
// Now turn the LED off, then pause
89
for
(
int
i = 0; i <
NUM_LEDS
; ++i) {
90
leds
[i] =
CRGB::Black
;
91
}
92
FastLED
.show();
93
delay(100);
94
}
setup
void setup()
Definition
AnalogOutput.ino:65
loop
void loop()
Definition
AnalogOutput.ino:54
NUM_LEDS
#define NUM_LEDS
Definition
Animartrix.ino:79
PIN_DATA
#define PIN_DATA
Definition
Animartrix.ino:66
leds
fl::CRGB leds[NUM_LEDS]
Definition
Animartrix.ino:93
FastLED
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition
FastLED.cpp.hpp:75
arduino.h
CRGB
fl::CRGB CRGB
Definition
crgb.h:25
fl::CRGB::Red
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition
crgb.h:622
fl::CRGB::Black
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition
crgb.h:510
Serial
#define Serial
Definition
serial.h:304
examples
Blink
Blink.ino
Generated on Tue Jun 16 2026 00:06:58 for FastLED by
1.13.2