FastLED 3.9.15
Loading...
Searching...
No Matches
TeensyMassiveParallel.h
Go to the documentation of this file.
1
13
14#if !defined(__IMXRT1062__) // Teensy 4.0/4.1 only.
15#include "platforms/sketch_fake.hpp"
16#else
17
18// As if FastLED 3.9.12, this is no longer needed for Teensy 4.0/4.1.
19#define FASTLED_USES_OBJECTFLED
20
21// Optional define to override the latch delay (microseconds)
22// #define FASTLED_OBJECTFLED_LATCH_DELAY 75
23#include "FastLED.h"
24#include "fl/warn.h"
25
26using namespace fl;
27
28#define PIN_FIRST 3
29#define PIN_SECOND 1
30#define IS_RGBW false
31
32#define NUM_LEDS1 (22 * 22)
33#define NUM_LEDS2 1
34CRGB leds1[NUM_LEDS1];
35CRGB leds2[NUM_LEDS2];
36
37void wait_for_serial(uint32_t timeout = 3000) {
38 uint32_t end_timeout = millis();
39 while (!Serial && end_timeout > millis()) {}
40}
41
42void print_startup_info() {
43 Serial.println("Start");
44 Serial.print("*********************************************\n");
45 Serial.print("* TeensyParallel.ino *\n");
46 Serial.print("*********************************************\n");
47 Serial.printf(
48 "CPU speed: %d MHz Temp: %.1f C %.1f F Serial baud: %.1f MHz\n",
49 F_CPU_ACTUAL / 1000000, tempmonGetTemp(),
50 tempmonGetTemp() * 9.0 / 5.0 + 32, 800000 * 1.6 / 1000000.0);
51}
52
53void setup() {
54 Serial.begin(115200);
55 wait_for_serial(3000);
56 CLEDController& c1 = FastLED.addLeds<WS2812, PIN_FIRST, GRB>(leds1, NUM_LEDS1);
57 CLEDController& c2 = FastLED.addLeds<WS2812, PIN_SECOND, GRB>(leds2, NUM_LEDS2);
58 if (IS_RGBW) {
59 c1.setRgbw();
60 c2.setRgbw();
61 }
62 FastLED.setBrightness(8);
63}
64
65void fill(CRGB color) {
66 for (int i = 0; i < NUM_LEDS1; i++) {
67 leds1[i] = color;
68 }
69 for (int i = 0; i < NUM_LEDS2; i++) {
70 leds2[i] = color;
71 }
72}
73
74void blink(CRGB color, int times, int delay_ms = 250) {
75 for (int i = 0; i < times; ++i) {
76 fill(color);
77 FastLED.show();
78 delay(delay_ms);
80 FastLED.show();
81 delay(delay_ms);
82 }
83}
84
85void loop() {
86 blink(CRGB::Red, 1);
88 blink(CRGB::Blue, 3);
89 delay(500);
90}
91
92#endif // __IMXRT1062__
void setup()
void loop()
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
central include file for FastLED, defines the CFastLED class/object
CLEDController & setRgbw(const Rgbw &arg=RgbwDefault::value())
Base definition for an LED controller.
WS2812 controller class.
Definition FastLED.h:218
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:16
IMPORTANT!
Definition crgb.h:20
@ Green
<div style='background:#008000;width:4em;height:4em;'></div>
Definition crgb.h:615
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>
Definition crgb.h:569
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition crgb.h:679
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:567
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86