Questions tagged [fastled]

The FastLED library is a popular library for easily and efficiently controlling a wide variety of pixel-addressable RGB LED chipsets, like the WS2812, APA102, and others. Use this tag for questions specifically about FastLED usage and development.

FastLED is a library for easily and efficiently controlling a wide variety of RGB, pixel-addressable LED chipsets, like the ones sold by AdaFruit under the brand names Neopixel and DotStar. These chips let you send an RGB color to a chip which contains red, blue, and green LEDs and they maintain that color. Popular LED chips include the WS2812b and family, the APA102c, and a bunch of related chips. Typically you control them by hooking them up to an Arduino or similar controller, programmed in C++, and send strings of bits through an output pin to the chips to specify the colors you want.

FastLED makes it easy to define an array of RGB colors, update it, and send it to your LEDs quickly.

In addition to writing to the LEDs, this library also includes a number of functions for high-performing 8-bit math for manipulating your RGB values, as well as low level classes for abstracting out access to pins and SPI hardware, while still keeping things as fast as possible. Tested with Arduino up to 1.6.5 from arduino.cc.

Advantages of FastLED:

Quick start for new developers - hook up your LEDs and go, no need to think about specifics of the led chipsets being used

Zero pain switching LED chipsets - you get some new LEDs that the library supports, just change the definition of LEDs you're using, et. voila! Your code is running with the new LEDs.

High performance - with features like zero cost global brightness scaling, high performance 8-bit math for RGB manipulation, and some of the fastest bit-bang'd SPI support around, FastLED wants to keep as many CPU cycles available for your LED patterns as possible.

69 questions
2
votes
4 answers

Can this for loop be done with the preprocessor?

My code uses a library (FastLED) which uses a templated function: #define NUM_WIDGETS 4 Library.function<1>(); Library.function<2>(); Library.function<3>(); Library.function<4>(); I can't put this in a normal for loop since the template argument…
Anna
  • 2,645
  • 5
  • 25
  • 34
2
votes
3 answers

Arduino ignoring serial interrupts when using FastLED

I have tried several different methods found around the internet, however none of them seem to work. This code works for cases 0-2 but when it goes into case 3 which is the rainbow chase loop, the pressing of the button does not interrupt the loop…
Beeker
  • 383
  • 4
  • 20
2
votes
1 answer

Issue with FastLED and a simple counter

Okay, I'm having one baffling issue with this code. The counter pushCounterz (named with a z only to rule out a conflicting variable) will start with the correct counter (1 or 0 or whichever) and one of a few things will happen when the button is…
Beeker
  • 383
  • 4
  • 20
2
votes
1 answer

Hash function for 8 / 16 bit "graphics" on 8 bit processor

For an implementation of coherent noise (similar to Perlin noise), I'm looking for a hash function suitable for graphics. I don't need it to be in any way cryptographic, and really, I don't even need it to be a super brilliant hash. I just want to…
Benjohn
  • 13,228
  • 9
  • 65
  • 127
1
vote
1 answer

If statement only works once

Here is my code: #include #define LED_PIN 7 #define NUM_LEDS 20 CRGB leds[NUM_LEDS]; void setup() { pinMode(A0, INPUT_PULLUP); FastLED.addLeds(leds, NUM_LEDS); } void loop() { if…
1
vote
0 answers

ESP32: Guru Meditation Error: Core 1 panic'ed (StoreProhibited)

I've been working on a LED strip lately trying to create all kinds of animations. But one of them has caused quite a lot of trouble. It's meant to be a kind of firework. It usually runs once and when the loop starts a second time the following error…
tom201
  • 11
  • 2
1
vote
1 answer

Environment Variables for Arudino / ESP32 module code

I have some simple FastLed & wifi code on my ESP32 module, but I don't want to store my WIFI ssid & password in the code (on github). So i'd like to have that info in a separate file that doesn't get checked into source control but DOES get compiled…
MaylorTaylor
  • 4,671
  • 16
  • 47
  • 76
1
vote
1 answer

How to get LED code to run from Keypad presses

I am using the FastLED library and the Keypad library to run code on my WS2812 lights. When I used just a basic keypad layout to print out what key was being pressed, this code worked. But now that I added methods to run code from the keypad if…
Kane
  • 13
  • 3
1
vote
1 answer

C++: Use #define constant in included header files (Arduino)

I'm using PlatformIO and I'm currently developing code for an ESP32. I have some sub libraries in which I want to be able to do debug logging. To enable the debug log I thought it would be nice to set a constant via #define MYDEBUG or so in the…
timothy3001
  • 765
  • 2
  • 8
  • 17
1
vote
1 answer

Arduino FastLed random behaviour

I'm trying to use FastLed on some WS2811 led strips but I get a weird behaviour. I'm using a simple code to debug the issue but still not working. Some leds are red but most are blue. I tried all the different LED strip type available in the FastLed…
Marchah
  • 160
  • 14
1
vote
0 answers

Cannot receive data more than once with 433Mhz on Arduino

I am currently building myself some lighting for my apartment using Arduinos and strips of WS2812b LEDs. My plan was to control them with an app from my smartphone and a Raspberry Pi. The phone sends data (like color, mode etc.) to the Pi and the Pi…
Kuuki
  • 11
  • 2
1
vote
2 answers

Adding colors to led using FastLED

I am trying to add colors that I set to an led using FastLED library on arduino Currently I am using fill_solid like so, leds(8 * CLUSTER, (8 * CLUSTER) + (CLUSTER - 1)).fill_solid(CRGB(255,0 ,0)); FastLED.show(); However, I am not able to add…
Pavan K
  • 4,085
  • 8
  • 41
  • 72
1
vote
1 answer

Arduino can't process serial fast enough

So my Arduino is taking almost 200ms processing a total of 128 bytes. The whole process without writing over the serial port is only taking 25ms. Why is my Arduino bottlenecking so much? Arduino setColor is simply setting the color of the ledstrip…
Arjan
  • 599
  • 5
  • 23
1
vote
1 answer

unexpected variable behavior arduino fastLED ws2812b

I have an arduino using fastLED with a strip of 600 ws2812b lights. I'm running the following code: #include "FastLED.h" #define DATA_PIN 5 // change to your data pin #define COLOR_ORDER GRB // if colors are mismatched; change…
IrppyDirppy
  • 61
  • 2
  • 7
1
vote
1 answer

Arduino Code optimization for multiplexing LED Matrix

I've build a 10x10RGB (no WS2811..., the normal ones) LED Matrix with 5 shift registers and 1 arduino micro. My Problem is now my code seems to be to slow or the arduino with its 16Mhz just cant handle a decent Hz rate. At the moment I get some…
Tom Stein
  • 345
  • 2
  • 15
1
2 3 4 5