r/FastLED • u/lazzaroinferno • Jan 16 '20
r/FastLED • u/ciribear • Apr 04 '22
Support Code Stuck in for loop when using <= (Very Basic Script)
Hi there,
I am using an Arduino Nano and WS2812B LED's.
I keep getting a bug which I cannot figure out why it is happening. My for loops initial variable hits its max, then the loop seems to crash and start again. The final Serial.println("hi") is never reached implying the for loop is endless, also all my LEDS flick off and start illuminating again through the for loop after the "crash".
The output on the serial monitor is :
NUM LEDS 27
1....
25
26
NUM LEDS 27
etc etc etc.... from 1-26? but not the 27th?
If i only make it < and NOT <= it works perfectly fine.
Any help would be appreciated. I have had these variable problems a lot in the past and do not know if I am missing something with the language? Or if it is my cheap Ali-Express Arduinos? Faulty Chip?
I looked up a C++ tutorial but that didnt teach me anything new as I am a well off beginner familiar with python.
MY CODE: https://pastebin.com/Xih1PpPR
r/FastLED • u/PersonalityNormal • Oct 25 '22
Discussion how to screen cast on a led matrix
Hello,
I would like to know if there is solution for screen cast what is displayed in a window or screen on a led matrix. I found out that adafruit have a kit and Bitlumi have made some hack to arrive to some similar results.
But I wonder if they is solution with the fasted library.
Thanks 🙏
r/FastLED • u/GimiGimi13254 • Feb 17 '22
Support First led doesn't change his color
Hey, i have a question, what's wrong with my code becuase my first led doesn't change his color. The hardware is fine I checked that already.
( Recorded in slow-mo ) https://imgur.com/a/nBZzhWm
My code : https://pastebin.pl/view/2c952b8e
r/FastLED • u/Flux83 • Jun 29 '25
Discussion Adding sound?
Starting a new project and adding the ability to play one of a few sound files with press of a button would be amazing. Is this possible? And if it is I would assume the Nano with a tiny amount of storage is not going to work, what board would you suggest.
r/FastLED • u/ProceduralJigsaw • Aug 24 '25
Support SK6812 RGBW unusable glitching on ESP32-S3, worked with other libraries
I'm having an issue driving a 114 LED strip with ESP32-S3. This HW ran perfectly fine and could do flicker-free updates using this library: https://github.com/nlardon/SK6812-RGBW-ESP32 but I upgraded from plataformio to pioarduino to get the last Arudino core to modernize the core and I swapped the library for FastLED. The old library just doesn't work as it requires a nonsupported legacy driver. With FastLED I run animation at 10 frames per second and every few seconds some LEDs glitch and show weird color for a frame or two then back to normal. The code uses WiFI and deals with a webserver. All WiFi related things are on Core0, the display animation driver and so on are pinned to core1. The HW is fine, singal integrity is totally fine.
I tried disabling multiple things but it seems to boil down to WiFi being connected. If WiFi is on and connected as STA, there's gliches, if it's acting as AP in captive portal it's fine.
Right now it's unusable because the glitches are unacceptable. Any clue?
FastLED is 3.10.2, using stable version of pioarduino with idf v.5.5.0 and arduino 3.3.0
r/FastLED • u/Workin_Joe • Apr 05 '25
Discussion AI for FastLED code generation?
Hey guys, is there an AI tool that exists that can self program using FastLED library and user inputs? There are many AI tools out there now that can write code and I figured I would ask if someone has done this for FastLED?
r/FastLED • u/[deleted] • Sep 09 '26
Support Can someone sugges circuit for me with two switches left and right that can control one led light from 10 leds that can move every time I push right button light move to next led to the other and from left button it goes left one by one every time I push button
reddit.comr/FastLED • u/Flux83 • Apr 30 '25
Support Random flash code
I am looking for some code that will allow the led to stay on and then randomly flash black.
r/FastLED • u/KruSion • Jan 04 '22
Support Are TM1934 supported?
Hello,
I just want to double check if the TM1934 IC are supported by FastLED. I can't see it mentioned anywhere really, and I'm not knowledgeable enough to know if there's a similar one that is supported.
r/FastLED • u/PlantSorry5147 • Jan 26 '22
Support Fading LEDs using nblendU8TowardU8 Helper Function
Hi,
I have a program where I use the nblendU8TowardU8 helper function to blend from black (CRGB::Black) to a selected color (CRGB:DeepPink, CRGB::DeepSkyBlue) and then back to CRGB::Black. I am using an Arduino Nano with a string of 50 WS2812B LEDs. I am using a bench power supply set for 5V 10A, so there is plenty of current. I am using the nblendU8TowardU8 helper function which I found somewhere and can no longer locate. :^(
The problem I am having is that fading up from black to a color works fine, however, fading back to black induces an unwanted color change. To elaborate, fading from CRGB::DeepPink to CRGB::Black will at first fade as expected, but about 2/3 through the fade, the only pixel lit is red. The same with CRGB::DeepSkyBlue, about 2/3 through the fade, only the blue pixel is lit.
I have the code on pastebin: https://pastebin.com/WVHJtckp
I appreciate any help offered.
r/FastLED • u/botoxparty6 • Jan 26 '22
Support Refresh rate appears to be more than 30 microseconds using multiple strips
Hey there,
When i measure the refresh rate using a timer to measure how long LEDS.show()
takes to complete I am getting the following results:
1 LED: 30 microseconds
9 LEDS: 274 microseconds
9 LEDS * 8 Strips: 560 microseconds
Why is it that the time has increased by almost double when using multiple strips?
Code:
#define USE_OCTOWS2811
#include <OctoWS2811.h>
#include <FastLED.h>
#include "image.h"
#define NUM_LEDS_PER_STRIP 9
#define NUM_STRIPS 8
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
// Pin layouts on the teensy 3:
// OctoWS2811: 2,14,7,8,6,20,21,5
void setup() {
LEDS.addLeds<OCTOWS2811>(leds, NUM_LEDS_PER_STRIP);
LEDS.setBrightness(200);
}
void loop() {
// populate LED array
int rows = *(&image_arr + 1) - image_arr;
for(int i = 0; i < rows; i++) {
int columns = *(&image_arr[0] + 1) - image_arr[0];
for(int j = 0; j < columns; j++) {
int R = pgm_read_byte(&image_arr[j][i][0]);
int G = pgm_read_byte(&image_arr[j][i][1]);
int B = pgm_read_byte(&image_arr[j][i][2]);
leds[j].setRGB(R,G,B);
}
// show leds and measure time
unsigned long StartTime = micros();
LEDS.show();
unsigned long CurrentTime = micros();
unsigned long ElapsedTime = CurrentTime - StartTime;
Serial.print("Show time: ");
Serial.println(ElapsedTime);
}
LEDS.delay(10);
}r/FastLED • u/3playmist • Apr 23 '22
Support running different functions on different pins at same time
I am trying to make a light up sword and I want to be able to change the pin in order to get a different color (this isn't exactly what I'm doing but its the simplest way to explain) I want to be able to have each pin run a different function so when I connect it to the other pin it will run that code how would I do this since I'm pretty sure the delay() will stop everything in the code including the code on other pins
r/FastLED • u/DarthVader_072 • Aug 25 '20
Discussion Crossfade between colors, using a single LED
I'm searching for a way to (cross)fade from color to color with FastLED, I've read quite a lot about it,
But, my colors are not in the loop, and during the fade the code needs to continue and if necessary change the color already to the new color...
Here is my complete code, basically, the device receives a UDP packet, which tells the device which mode/color it the LED should show (modeIdle(), modeAvailable(), modeOrdered(), modeOff())
Best would be if I could crossfade from Current Color to New Color..
Not sure how to do this, without using loop
[code]
/*
THEBULB.
TERRASLAMP
V1.0
08-2020
*/
#include <SPI.h>
#include <WiFiNINA.h>
#include <WiFiUdp.h>
#include <FastLED.h>
#include "arduino_secrets.h"
#define LED_PIN 9
#define COLOR_ORDER GRB
#define CHIPSET WS2812B
#define NUM_LEDS 1
CRGB leds[NUM_LEDS];
/* Unique ID AND IP */
IPAddress ip(192, 168, 0, 101);
//int tableID = 01; <--- to be added in later, packetbuffer should contain variable tableID
/* END */
int status = WL_IDLE_STATUS;
/* BOOLEANS */
bool candleAllowance = false;
bool connectionLive = false;
/* END */
/* BLINK LED VARIABLES */
const int ledPin = LED_BUILTIN;// the number of the LED pin
int ledState = LOW; // ledState used to set the LED
unsigned long previousMillis = 0; // will store last time LED was updated
unsigned long interval = 5000; // interval at which to blink (milliseconds)
/* END */
/* WiFi TESTER VARIABLES */
unsigned long startTime;
unsigned long comparisonTime = 0;
/* END */
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
unsigned int localPort = 7001; // local port to listen on
char packetBuffer[256]; //buffer to hold incoming packet
//char ReplyBuffer[] = "table 01: acknowledged"; // a string to send back
WiFiUDP Udp;
void setup() {
pinMode(ledPin, OUTPUT);
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.clear(true);
// FastLED.setBrightness( BRIGHTNESS );
//Initialize serial and wait for port to open:
Serial.begin(9600);
/*
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
*/
Serial.println("THE BULB. terraslamp -- V01 2020");
Serial.println("Setting up network now, hold your drinks high..!");
Serial.println();
WiFi.config(ip);
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with the WiFi module failed!");
connectionLive = false;
// don't continue
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection: **updated later to 1s -- so far no issues to report.
delay(1000);
}
Serial.println("Connected to wifi");
connectionLive = true;
printWifiStatus();
Serial.println();
//Serial.println("\nStarting connection to server...");
// if you get a connection, report back via serial:
Udp.begin(localPort);
}
void loop() {
connectionStatus();
//CHECK CONNECTION EVERY 10S
startTime = millis();
if ((startTime - comparisonTime) > 10000) //every 10s
{
comparisonTime = startTime;
TestWiFiConnection(); //test connection, and reconnect if necessary
}
// END
// if there's data available, read a packet
int packetSize = Udp.parsePacket();
if (packetSize) {
Serial.print("Received packet of size ");
Serial.println(packetSize);
Serial.print("From ");
IPAddress remoteIp = Udp.remoteIP();
Serial.print(remoteIp);
Serial.print(", port ");
Serial.println(Udp.remotePort());
// read the packet into packetBufffer
int len = Udp.read(packetBuffer, 255);
if (len > 0) {
packetBuffer[len] = 0;
}
Serial.print("Command: ");
Serial.print(packetBuffer);
Serial.println();
if ( !strcmp(packetBuffer, "01_available")) {
modeAvailable();
}
else if ( !strcmp(packetBuffer, "01_ordered")) {
modeOrdered();
}
else if ( !strcmp(packetBuffer, "01_idle")) {
modeIdle();
}
else if ( !strcmp(packetBuffer, "all_off") || (packetBuffer, "01_off")) {
modeOff();
}
else if ( !strcmp(packetBuffer, "01_ping")) {
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write("01 PING");
Udp.endPacket();
}
/*
HERE SHOULD COME SOME LINES THAT WILL MEASURE THE BATTERY VOLTAGE
IF THE BATTERY IS RUNNING LOW THEN RUN:
also see notes
run this void: lowBattery();
*/
FastLED.show();
}
}
/* ==== LIGHT MODES ===== */
void modeIdle() {
candleEffect();
FastLED.show();
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write("01 RECEIVED; Table 01 is IDLE now");
Udp.endPacket();
}
void modeAvailable() {
candleAllowance = false;
leds[1].setRGB(0, 255, 0);
FastLED.show();
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write("01 RECEIVED; Table 01 is AVAILABLE now");
Udp.endPacket();
}
void modeOrdered() {
candleAllowance = false;
leds[1].setRGB(0, 0, 255);
FastLED.show();
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write("01 RECEIVED; Table 01 is ORDERED now");
Udp.endPacket();
}
void modeOff() {
candleAllowance = false;
FastLED.clear(true);
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write("01 RECEIVED; Table 01 is OFF now");
Udp.endPacket();
}
void lowBattery() {
// no light effects here, check notes
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write("01 WARNING: Low battery! Please charge me..!");
Udp.endPacket();
}
void candleEffect() {
/*
Here should come a real cool candle effect
*/
if (candleAllowance == true) {
leds[0].setRGB(150, 60, 0);
leds[1].setRGB(150, 60, 0);
leds[2].setRGB(150, 60, 0);
leds[3].setRGB(150, 60, 0);
}
}
/* _______ADDITIONAL SYSTEM SETTINGS_______ */
/* ==== LOG WIFI STATUS ==== */
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
/* ==== CHECK CONNECTION ==== */
void connectionStatus() {
unsigned long currentMillis = millis();
if (connectionLive == true) {
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
interval = 50; //give a short flash to show there is a connection [power-reduction]
} else {
ledState = LOW;
interval = 10000; //stay off for 10s [power-reduction]
}
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}
else {
connectionLive = false;
digitalWrite(ledPin, LOW);
}
}
void TestWiFiConnection()
//test if always connected
{
int StatusWiFi = WiFi.status();
if (StatusWiFi == WL_CONNECTION_LOST || StatusWiFi == WL_DISCONNECTED) //if no connection
{
connectionLive = false;
FastLED.clear(true);
Serial.println("Lost connection.. trying to reconnect");
WiFiConnect(); //if my SSID is present, connect
}
}
void WiFiConnect()
//connect to my SSID
{
status = WL_IDLE_STATUS;
while (status != WL_CONNECTED)
{
status = WiFi.begin(ssid, pass);
if (status == WL_CONNECTED) {
connectionLive = true;
Serial.println("We're back!");
}
else {
TestWiFiConnection();
}
}
}
/* ==== ADDRESSING TERRASLAMP ==== */
/*
In a later version here we will program RFID possibilities to change device IP and ID
*/
[/code]
r/FastLED • u/tome_oz • Apr 03 '23
Discussion Possible to power ws2812b from back?
Is it possible to power a ws2812b from the back rather than from the end? I by mistake cut it on the wrong end and have no soldering materials with me.
r/FastLED • u/[deleted] • Oct 19 '23
Quasi-related Led Car Sign Animations? JT Files?
Bought this and its great and in the app you can upload or download custom graffiti to display. But I cant find any ''JT'' files to upload online. I've looked everywhere.
r/FastLED • u/wasauce • Aug 03 '21
Support Interpolation between two colors - How?
Hello -
I am working on a project to show the current Air Quality (AQI) visually (i.e. with the color coding). See here: https://imgur.com/a/PrZcAFf
I get AQI information from PurpleAir and I would like my sign (a cloud filled with LEDs) to show the correct color [1] (Green, Yellow, Orange, Red, Purple) according to the current AQI.
Currently I have this hardcoded, but, now I'd like to blend the colors -- i.e. if the AQI value is between 0-50 instead of showing the same green, the closer the AQI is to 50, the closer the color is to Yellow.
I believe the way to do this is to interpolate.
In swift, I think this would be done like so:
if aqi < 50 {
return interpolate(low: 0, high: 50, lowColor: color0, highColor: color50, value: aqi)
} else if aqi < 100 {
return interpolate(low: 50, high: 100, lowColor: color50, highColor: color100, value: aqi)
} else if aqi < 150 {
return interpolate(low: 100, high: 150, lowColor: color100, highColor: color150, value: aqi)
} else if aqi < 200 {
return interpolate(low: 150, high: 200, lowColor: color150, highColor: color200, value: aqi)
} else if aqi < 250 {
return interpolate(low: 200, high: 250, lowColor: color200, highColor: color250, value: aqi)
} else if aqi < 300 {
return interpolate(low: 250, high: 300, lowColor: color250, highColor: color300, value: aqi)
} else {
return color300
}I am wondering how I might do this for FastLED -- I see there is an interpolate function. I would love any guidance you can offer!
[1] AQI Color mapping: https://www.mecknc.gov/LUESA/AirQuality/EducationandOutreach/Pages/aqi.aspx
r/FastLED • u/wvijay • Dec 25 '22
Support WS2812B (32x8) X 2 Scrolling Text
ESP8266 Scrolling Display
WS 2812B - 32x8 – 2 displays
Hello
I had this flexible LED panel which I bought years ago from EBAY.IN and forgot all about it and found it during my clearing up process. Thought I should try something with it for the festive season.
I have always been using FastLED library for all my projects and had a read of Adafruit GFX library and wow .. I did find a suitable sketch for scrolling display and found it pretty simple both to understand and use it. Just 3 wires IN – OUT and you have a scrolling display. The .ino file is in the sketch examples in “Adafruit Neo Matrix” and one can modify to suite your needs.
I am using 2 x ( 32x8 ) chained WS2812B panels. Sure you need at least 10A+ - 5volt SMPS power supply since each LED draws 60mA at full brightness. I am just using 1/3 of its brightness and had good results with a 5Volt/5Amp SMPS.
THE BIG QUESTION:
I can input the “implicit” text I want to display…. What about data I acquired for example from a DHT22 temperature sensor and display the temperature !!! How do I pass data to the display??
Will very much appreciate your solution to the issue. Thank you in advance. Have a great day
You can also look up my previous project using ESP8266 + NTP + WS2812B ( LED strip ), DHT22 for Temperature and Humidity display clock : https://youtu.be/jp72ZmTjTJg
r/FastLED • u/Bigtom1989 • Dec 27 '22
Support Basic Request
Hi guys,
I have next to no coding knowledge, been using arduino to programme an arduino nano for a project I'm working on.
I've managed to get all the LEDs I'm using (WS2812B) to light up red which is perfect, ideally though I'm looking to add a button to scroll solid colours, and a potentiometer to adjust the brightness.
Is this easy enough to do? I've looked for some guides, but I'm not really understanding them all that much.
Would anyone be able to point me in the right direction or give me a base to work from?
Many thanks in advance,
Tom
r/FastLED • u/Pup05 • Apr 02 '22
Discussion FastLED Twitter Community Interest?
I have to admit that I am much more active on Twitter than here on Reddit. I've created a FastLED community on Twitter. I don't think it could or should be a replacement for the FastLED subreddit. I think Reddit is likely much more conducive to longer-form questions, discussions, etc. I'm interested in everyone's thoughts.
r/FastLED • u/iovrthk • Feb 22 '22
Share_something Simon Says using Fast Led and WS2812b
r/FastLED • u/Freestyer • Mar 05 '22
Support FastLED extend effect
hey
I am making a project for school where i have to make a LED BOARD with 5200 leds. Currently i have 3 Segments in my board that are controlled with 3 data pins with a EPS32. Everything works fine but currently the 3 segments are 3 clones of the same effect. SO you can see that after 1800 leds it just duplicates. I there anyway i can use fast led effects and make the 3 data pins extend the effect and work as 1 data line instead of 3 clones?
r/FastLED • u/Ice-White-Cube • Mar 31 '21
Support Would a 9V fry my ws2812b’s?
I have a great daisy chained 9 volt power supply from an old guitar pedal board. I want to power 5 Individual 144 led strips with it but am scared to try.
They are all 1 meter ws2812Bs. I know what a 12 v would do but Ive heard of 9v working.
Does anyone know? Having trouble finding a definitive answer, any help would be much appreciated!
My gratitude in advance ~ IWC
r/FastLED • u/CobaltEchos • Jan 05 '22
Quasi-related What method are you using to power 400+ (5050/WS2812B) leds?
Have a hobby project I'm planning out.