FastLED 3.9.15
Loading...
Searching...
No Matches
TeensyParallel.ino
Go to the documentation of this file.
1
2// This is an prototype example for the ObjectFLED library for massive pins on
3// teensy40/41.
4
5#if !defined(__IMXRT1062__) // Teensy 4.0/4.1 only.
6#include "platforms/sketch_fake.hpp"
7#else
8
9#define FASTLED_USES_OBJECTFLED
10
11#include "FastLED.h"
12#include "fl/warn.h"
13
14using namespace fl;
15
16#define PIN_FIRST 3
17#define PIN_SECOND 1
18#define IS_RGBW false
19
20#define NUM_LEDS1 (22 * 22)
21#define NUM_LEDS2 1
22CRGB leds1[NUM_LEDS1];
23CRGB leds2[NUM_LEDS2];
24
25void wait_for_serial() {
26 uint32_t end_timeout = millis() + 3000;
27 while (!Serial && end_timeout > millis()) {}
28}
29
30void print_startup_info() {
31 Serial.println("Start");
32 Serial.print("*********************************************\n");
33 Serial.print("* TeensyParallel.ino *\n");
34 Serial.print("*********************************************\n");
35 Serial.printf(
36 "CPU speed: %d MHz Temp: %.1f C %.1f F Serial baud: %.1f MHz\n",
37 F_CPU_ACTUAL / 1000000, tempmonGetTemp(),
38 tempmonGetTemp() * 9.0 / 5.0 + 32, 800000 * 1.6 / 1000000.0);
39}
40
41void dump_last_crash() {
42 if (CrashReport) {
43 Serial.println("CrashReport:");
44 Serial.println(CrashReport);
45 }
46}
47
48void setup() {
49 Serial.begin(115200);
50 wait_for_serial();
51 dump_last_crash();
52 CLEDController& c1 = FastLED.addLeds<WS2812, PIN_FIRST, GRB>(leds1, NUM_LEDS1);
53 CLEDController& c2 = FastLED.addLeds<WS2812, PIN_SECOND, GRB>(leds2, NUM_LEDS2);
54 if (IS_RGBW) {
55 c1.setRgbw();
56 c2.setRgbw();
57 }
58 FastLED.setBrightness(8);
59}
60
61void fill(CRGB color) {
62 for (int i = 0; i < NUM_LEDS1; i++) {
63 leds1[i] = color;
64 }
65 for (int i = 0; i < NUM_LEDS2; i++) {
66 leds2[i] = color;
67 }
68}
69
70void blink(CRGB color, int times, int delay_ms = 250) {
71 for (int i = 0; i < times; ++i) {
72 fill(color);
73 FastLED.show();
74 delay(delay_ms);
76 FastLED.show();
77 delay(delay_ms);
78 }
79}
80
81void loop() {
82 blink(CRGB::Red, 1);
84 blink(CRGB::Blue, 3);
85 delay(500);
86}
87
88#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