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
1
vote
1 answer

C++ Array Values Not Changing

I am working with FastLED on a Particle Photon in C++ and am trying to assign a new value to one of the elements of the pixel array. Essentially, I have a array declared as such: NSFastLED::CRGB leds[1]; I pass this into an "animation" class I've…
Andrew M
  • 4,208
  • 11
  • 42
  • 67
1
vote
0 answers

Converting 2D row col position (cartesian) coordinates to 1D array index

So I'm using the FastLED library with Arduino (8-bit AVR) and I have my LEDs arranged in a regular 2D grid (serpentine pattern). To produce bitmap text and images I need a way converting 2D Cartesian coordinates to a physical LED (array index)…
Mr. Anderson
  • 83
  • 1
  • 8
1
vote
1 answer

Speed up code for serial protocols using bitbanging

I'm wondering if there are any particularly fast ways to read or write a serial protocol (such as SPI) using GPIO calls (bitbanging) on a microcontroller. What is fastest may be somewhat architecture-specific, but a smaller number of operations is…
Alex I
  • 19,689
  • 9
  • 86
  • 158
1
vote
1 answer

Can you declare a constant object in a function?

One semester of Comp Sci under my belt, here goes nothing. I need to call a constant int to use for the number of LEDs are in a strip for FastLED. Long story short, I'm trying to replace... #include "FastLED.h" #define NUM_LEDS_RT 174 …
Retro
  • 11
  • 4
1
vote
2 answers

lighting two ends of LED strip using Arduino fastLED library

I have a LED strip(WS2812B) of 60 LED's. I have the following code which lights up a LED at the beginning of the strip and sends it down to the end, once it reaches the end it 'bounces back' and returns down the strip to the start. What I'm trying…
user3650687
  • 11
  • 1
  • 1
  • 2
0
votes
1 answer

Arduino FastLED turn on leds in stages then flash the last segment

I would like to turn on segments of LEDs, first 4 followed by a delay then the next 4 LEDs followed by a delay then turn on the last 4 but have them flash at a smaller delay. when I tried this I get it to flash but the differences in delays does…
0
votes
2 answers

how can I change RGB values according to percentage

I want to change RGB values according to the percentage. means 0% should show Red , 50% should green and 100% will Blue color.I am working on fastled.I tried like this but didnt get the best result.can anyone suggest some good stuf?? int R,G,B; int…
0
votes
1 answer

Trigger a function on alarm time

i am trying to make an alarm clock with esp8266 and ws2812b leds. On alarm time it must call the sunrise() function. The sunrise() function works fine when i put it directly in the loop function. But it doesn't work in alarm trigger. if…
GkNx
  • 159
  • 1
  • 1
  • 5
0
votes
1 answer

Arduino: Cannot move from one state to another (FastLED + Pixel Matrix)

I am trying to write a test code on Arduino with a LED Matrix I have built. I wrote a couple of functions for animating graphics on the LED Matrix and wanted to change the animation at different integer 'parseInt' through Serial monitor. However, I…
thetaisnew
  • 23
  • 4
0
votes
1 answer

FASTLED.show() stops working when working in core 1 FREERTOS (after deleting the task running a pattern and creating a new one)

I have a couple of pattern functions and one task (Task1) which runs on core 1. I receive data (pattern no.) from BLE in core 0. Depending on the data, I create the task above with the task function as the chosen pattern. Problem comes when I want…
0
votes
2 answers

How to Change the colour of LED's with fastLED and a ESP32

so I developed an app which will send a series of integers over Bluetooth (for RED, GREEN & BLUE) to a ESP32 which will then change the colour of 3 LED's (WS2811) based on the numbers it receives. It works the first time I send them but when I try…
dazz500
  • 1
  • 1
0
votes
1 answer

Arduino - Creating FastLED Arrays

I can manually set a bunch of LED's line by line, but would like to be able to do it with an array declaration and for statement. The code that works is here: #include #define LED_PIN 2 #define NUM_LEDS 50 CRGB leds[NUM_LEDS]; void…
GregT
  • 1
0
votes
1 answer

Arduino Fastled moving rainbow without blue

I have a lamp based on Arduino with moving rainbow effect via FastLED library. The code is: void rainbow(){ hue += 2; for (int i = 0; i < NUM_LEDS; i++) leds[i] = CHSV((byte)(hue + i * float(255 / NUM_LEDS)), 255, 255); } So I…
0
votes
0 answers

THREE JS PointLight smooth colour Interpolation animation effects like fastLED, WLED

You can find a Prototyp of this Web Project here (this site is not up to date so the animate() function you will find there will probably not match the one below) the color palette looks like this: let party = [ 0x5500ab, 0x84007c, …
it.Carl
  • 1
  • 1
0
votes
1 answer

C++ Arduino Vector issues with mismatched types?

I've been trying to write some effects for a strip of RGB LEDs to be controlled via an Arduino Uno R3. For context, I'm working on the animation of a ball (a set of 5 LEDs) moving backwards and forward along the strip, bouncing from time to…