FastLED 3.9.15
Loading...
Searching...
No Matches
Cylon.ino
Go to the documentation of this file.
1
5
6#include <FastLED.h>
7
8using namespace fl;
9
10// How many leds in your strip?
11#define NUM_LEDS 64
12
13// For led chips like Neopixels, which have a data line, ground, and power, you just
14// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
15// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
16#define DATA_PIN 2
17#define CLOCK_PIN 13
18
19// Define the array of leds
21
22void setup() {
23 Serial.begin(57600);
24 Serial.println("resetting");
26 FastLED.setBrightness(84);
27}
28
29void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
30
31void loop() {
32 static uint8_t hue = 0;
33 Serial.print("x");
34 // First slide the led in one direction
35 for(int i = 0; i < NUM_LEDS; i++) {
36 // Set the i'th led to red
37 leds[i] = CHSV(hue++, 255, 255);
38 // Show the leds
39 FastLED.show();
40 // now that we've shown the leds, reset the i'th led to black
41 // leds[i] = CRGB::Black;
42 fadeall();
43 // Wait a little bit before we loop around and do it again
44 delay(10);
45 }
46 Serial.print("x");
47
48 // Now go in the other direction.
49 for(int i = (NUM_LEDS)-1; i >= 0; i--) {
50 // Set the i'th led to red
51 leds[i] = CHSV(hue++, 255, 255);
52 // Show the leds
53 FastLED.show();
54 // now that we've shown the leds, reset the i'th led to black
55 // leds[i] = CRGB::Black;
56 fadeall();
57 // Wait a little bit before we loop around and do it again
58 delay(10);
59 }
60}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
void fadeall()
Definition Cylon.ino:29
void setup()
Definition Cylon.ino:22
void loop()
Definition Cylon.ino:31
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
central include file for FastLED, defines the CFastLED class/object
WS2812 controller class.
Definition FastLED.h:210
@ RGB
Red, Green, Blue (0012)
Definition eorder.h:15
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55