FastLED 3.9.12
Loading...
Searching...
No Matches
TeensyMassiveParallel.ino
1
13
14#if !defined(__IMXRT1062__) // Teensy 4.0/4.1 only.
15void setup() {}
16void loop() {}
17#else
18
19// As if FastLED 3.9.12, this is no longer needed for Teensy 4.0/4.1.
20#define FASTLED_USES_OBJECTFLED
21
22// Optional define to override the latch delay (microseconds)
23// #define FASTLED_OBJECTFLED_LATCH_DELAY 75
24#include "FastLED.h"
25#include "fl/warn.h"
26
27using namespace fl;
28
29#define PIN_FIRST 3
30#define PIN_SECOND 1
31#define IS_RGBW false
32
33#define NUM_LEDS1 (22 * 22)
34#define NUM_LEDS2 1
35CRGB leds1[NUM_LEDS1];
36CRGB leds2[NUM_LEDS2];
37
38void wait_for_serial(uint32_t timeout = 3000) {
39 uint32_t end_timeout = millis();
40 while (!Serial && end_timeout > millis()) {}
41}
42
43void print_startup_info() {
44 Serial.println("Start");
45 Serial.print("*********************************************\n");
46 Serial.print("* TeensyParallel.ino *\n");
47 Serial.print("*********************************************\n");
48 Serial.printf(
49 "CPU speed: %d MHz Temp: %.1f C %.1f F Serial baud: %.1f MHz\n",
50 F_CPU_ACTUAL / 1000000, tempmonGetTemp(),
51 tempmonGetTemp() * 9.0 / 5.0 + 32, 800000 * 1.6 / 1000000.0);
52}
53
54void setup() {
55 Serial.begin(115200);
56 wait_for_serial(3000);
57 CLEDController& c1 = FastLED.addLeds<WS2812, PIN_FIRST, GRB>(leds1, NUM_LEDS1);
58 CLEDController& c2 = FastLED.addLeds<WS2812, PIN_SECOND, GRB>(leds2, NUM_LEDS2);
59 if (IS_RGBW) {
60 c1.setRgbw();
61 c2.setRgbw();
62 }
64}
65
66void fill(CRGB color) {
67 for (int i = 0; i < NUM_LEDS1; i++) {
68 leds1[i] = color;
69 }
70 for (int i = 0; i < NUM_LEDS2; i++) {
71 leds2[i] = color;
72 }
73}
74
75void blink(CRGB color, int times, int delay_ms = 250) {
76 for (int i = 0; i < times; ++i) {
77 fill(color);
78 FastLED.show();
79 delay(delay_ms);
80 fill(CRGB::Black);
81 FastLED.show();
82 delay(delay_ms);
83 }
84}
85
86void loop() {
87 blink(CRGB::Red, 1);
88 blink(CRGB::Green, 2);
89 blink(CRGB::Blue, 3);
90 delay(500);
91}
92
93#endif // __IMXRT1062__
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:45
central include file for FastLED, defines the CFastLED class/object
void setBrightness(uint8_t scale)
Set the global brightness scaling.
Definition FastLED.h:719
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
Definition FastLED.cpp:94
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Definition FastLED.cpp:79
Base definition for an LED controller.
WS2812 controller class.
Definition FastLED.h:190
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:17
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54
@ Green
Definition crgb.h:544
@ Blue
Definition crgb.h:498
@ Red
Definition crgb.h:608
@ Black
Definition crgb.h:496