Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
Hi - I’m hoping someone can give me a steer on how to approach modifying Hans' excellent ‘fire’ sketch for a stage prop I’m putting together. (Now hopefully posted in the right place!)
Put simply, I have two 150 LED strips laid end to end with the Arduino in-between the two strips. Each strip is connected to a different data output on the Arduino.
I need to make the fire start at the far left of the first strip (i.e. LED 150), move to the right (to LED 1) then continue on to the second strip (LED 1) finishing at the far right of this strip (LED 150) making a combined 300 LED strip.
I have completed a few large Arduino projects and think I understand how most of the code in the sketch works, but I am struggling to see how I can get the ‘fire’ to pass to a separate instance of FastLED for the second strip. It may be that there are better ways to address this?
So, if I understand this right, you'd like to use all 300 LEDs for the "fire", as in: one flame over all 300 LEDs?
If so, then really the easiest option is to connect both strips instead of trying to control 2 strips. So let's say we connect strip2 at the end of strip1, then you only have to connect +5V, GND and D0 (to Din of strip 2) from Strip1 to Strip2. Next change NUM_LEDS in your code to 300 and you're good to go.
Tip: if the brightness of the last LEDs is not so great, then you may need to run an extra +5V and GND wire from your power supply. This can be connected where you link the two strips, or at the end of Strip 2. I've noticed once where white light at the end (also 300 LEDs) started becoming more yellowish. Connecting the power supply also to the end of the strip made that go away. Since you're using the fire effect though, you may not need this.
If linking the two strips is not an option, then consider this;
Normally the LED closest to your Arduino would be LED 1. So simplified you're looking at this:
And you want the fire to start on the left with #149 and end on the right with #149. I hope I understood that correctly. 😉
Looking at the Fire Code, I'd first replace all occurrences of NUM_LEDS with the newly define ALL_LEDS, so that the effect assumes 300 LEDs to work with.
void Fire(int Cooling, int Sparking, int SpeedDelay) {
static byte heat[ALL_LEDS];
int cooldown;
// Step 1. Cool down every cell a little
for( int i = 0; i < ALL_LEDS; i++) {
cooldown = random(0, ((Cooling * 10) / ALL_LEDS) + 2);
if(cooldown>heat[i]) {
heat[i]=0;
} else {
heat[i]=heat[i]-cooldown;
}
}
// Step 2. Heat from each cell drifts 'up' and diffuses a little
for( int k= ALL_LEDS - 1; k >= 2; k--) {
heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2]) / 3;
}
// Step 3. Randomly ignite new 'sparks' near the bottom
if( random(255) < Sparking ) {
int y = random(7);
heat[y] = heat[y] + random(160,255);
//heat[y] = random(160,255);
}
// Step 4. Convert heat to LED colors
for( int j = 0; j < ALL_LEDS; j++) {
setPixelHeatColor(j, heat[j] );
}
showStrip();
delay(SpeedDelay);
}
You'll see that in this function, none of the leds are being set yet. This is done in the setPixelHeatColor function where setPixel() is being called. So in setPixel() we can do some magic to pick the right LEDs.
So if the function want to set the first LED, we need to use strip1 LED 149. (LEDs start counting with zero since "leds" is an array of 150 elements, where 149 is the last one) I hope I don't screw up the math here ... but in essence we want this:
LED 0 -> Use strip 1, LED 149 (= NUM_LEDS-1 - Pixel = 150-1 - 0 = 149) LED 149 -> Use strip 1, LED 0 (= NUM_LEDS-1 - Pixel = 150-1 - 149 = 0) LED 150 -> Use strip 2, LED 0 (= Pixel - NUM_LEDS = 150 - 150 = 0) LED 299 -> Use Strip 2, LED 149 (= Pixel - NUM_LEDS = 299 - 150 = 149)
Which we can do in the setPixel function, something like this (pseudo code):
if Pixel<150 then Use Strip1, and LED = (NUM_LEDS-1) - Pixel else Use Strip2, and LED = Pixel - NUM_LEDS
Since I assumed you're using FastLED, we could rewrite the setPixel function to this:
Now keep in mind; I have not tested this code, and I do screw up every now and then when it comes to counting and array's. I'm pretty sure though this will be close to what you're looking for.
I do need to have the Arduino in the middle as I simplified the question a little as the design actually calls for three LED strips (although two mirror each other). Your proposed solution is very elegant and should be just what I need.
I'm still learning a lot from your other examples 😀
Security Awareness Tip of the Day Great resource to make you online-life more secure - definitely some great tips here and a recommended read.
VLC - VideoLAN Media Player One of the most flexible media players around and available on multiple computer platforms. Handles pretty much any audio and video type available and plays DVD as well.
ViMediaManager ViMediaManager is a media manager for Mac OS X, allowing you to gather, store, and manage information, extra art, trailers and television tunes for your movie, television etc for use with for example XBMC.
7-Zip One of the best, free, and most efficient Windows archive and unarchive utilties around. Support quite a few formats as well.
Google Fonts Very large collection of high quality and free TrueType/OpenType fonts.
Photopea A free alternative to Photoshop (pretty close anyway), and runs in your browser - this works surprisingly good!
Links Page These and more of our favorite links can be found on the Links Page.
New Downloads
RenameMyTVSeries-2.3.3-GTK-Linux-x64-static-ffmpeg.tar.xzDate: 2025-07-15 - Size: 78.3 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle comes with (large) static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.3-QT5-Linux-x64-static-ffmpeg.tar.xzDate: 2025-07-15 - Size: 78.3 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle comews with rather large static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.3-GTK-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-07-15 - Size: 1.9 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
RenameMyTVSeries-2.3.3-QT5-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-07-15 - Size: 1.9 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
RenameMyTVSeries-2.3.3-Windows-x64-setup.exeDate: 2025-07-15 - Size: 48.8 MBRename My TV Series, for Windows (Intel 64 bit), a tool to assist in renaming TV Show episode files. Static builds of ffmpeg and ffprobe are included.
RenameMyTVSeries-2.3.3-macOS-Universal.dmgDate: 2025-07-15 - Size: 98.6 MBRename My TV Series, for macOS (Universal binary for Apple Silicon ARM and Intel 64 bit), a tool to assist in renaming TV Show episode files. Static universal binary builds of ffmpeg and ffprobe are included.
Downloads Page Find these and more Downloads on the Downloads Page, where you will also find articles references, operating system requirements and categories.
Amazon Ads
Support us by doing your shopping at Amazon.com, either click the link, or click one of the links below …
You can also sponsor us through these Amazon offerings:
Please consider disabling your ad blocker for our website.We rely on these ads to be able to run our website.You can of course support us in other ways (see Support Us on the left).