FastLED
3.9.15
Loading...
Searching...
No Matches
Cylon.ino
Go to the documentation of this file.
1
5
6
#include <FastLED.h>
7
8
// How many leds in your strip?
9
#define NUM_LEDS 64
10
11
// For led chips like Neopixels, which have a data line, ground, and power, you just
12
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
13
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
14
#define DATA_PIN 2
15
#define CLOCK_PIN 13
16
17
// Define the array of leds
18
CRGB
leds
[
NUM_LEDS
];
19
20
void
setup
() {
21
Serial
.begin(57600);
22
Serial
.println(
"resetting"
);
23
FastLED
.addLeds<WS2812,
DATA_PIN
,
RGB
>(
leds
,
NUM_LEDS
);
24
FastLED
.setBrightness(84);
25
}
26
27
void
fadeall
() {
for
(
int
i = 0; i <
NUM_LEDS
; i++) {
leds
[i].nscale8(250); } }
28
29
void
loop
() {
30
static
uint8_t
hue
= 0;
31
Serial
.print(
"x"
);
32
// First slide the led in one direction
33
for
(
int
i = 0; i <
NUM_LEDS
; i++) {
34
// Set the i'th led to red
35
leds
[i] =
CHSV
(
hue
++, 255, 255);
36
// Show the leds
37
FastLED
.show();
38
// now that we've shown the leds, reset the i'th led to black
39
// leds[i] = CRGB::Black;
40
fadeall
();
41
// Wait a little bit before we loop around and do it again
42
delay(10);
43
}
44
Serial
.print(
"x"
);
45
46
// Now go in the other direction.
47
for
(
int
i = (
NUM_LEDS
)-1; i >= 0; i--) {
48
// Set the i'th led to red
49
leds
[i] =
CHSV
(
hue
++, 255, 255);
50
// Show the leds
51
FastLED
.show();
52
// now that we've shown the leds, reset the i'th led to black
53
// leds[i] = CRGB::Black;
54
fadeall
();
55
// Wait a little bit before we loop around and do it again
56
delay(10);
57
}
58
}
setup
void setup()
Definition
AnalogOutput.ino:65
loop
void loop()
Definition
AnalogOutput.ino:54
NUM_LEDS
#define NUM_LEDS
Definition
Animartrix.ino:79
leds
fl::CRGB leds[NUM_LEDS]
Definition
Animartrix.ino:93
DATA_PIN
#define DATA_PIN
Definition
ClientReal.h:82
fadeall
void fadeall()
Definition
Cylon.ino:27
FastLED
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition
FastLED.cpp.hpp:75
hue
uint8_t hue
Definition
advanced.h:94
RGB
constexpr EOrder RGB
Definition
eorder.h:17
CHSV
fl::hsv8 CHSV
Definition
chsv.h:11
CRGB
fl::CRGB CRGB
Definition
crgb.h:25
Serial
#define Serial
Definition
serial.h:304
examples
Cylon
Cylon.ino
Generated on Tue Jun 16 2026 00:06:58 for FastLED by
1.13.2