Page 1 of 1

Arduino – All LED effects in one Sketch

Arduino – All LED effects in one Sketch

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.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.

RSS Feed

Home Forums Hardware Arduino Arduino – All LED effects in one Sketch

This topic contains 67 replies, has 20 voices, and was last updated by  haydenrigg 1 week, 2 days ago.

Viewing 8 posts - 61 through 68 (of 68 total)
  • Author
  • 11402


    Awesome Dai! Well done!

    The only thing is that you forgot to add this in the fire effect, but otherwise it’s good (if not better) alternative to using the EEPROM. 



    The code with the fire effect fixed … (attached INO file).

    Hopefully I didn’t introduce new typo’s 



    I wanted to make certain pattern in my Neopixels which was gradually adding all pixels with random colors using Neopixel library.
    please, see the attachment for the code.
    Thanks to Hans,



    Awesome Ronac! 

    I assume this worked for you?



    Yup, its working fine.



    Hi. I’m trying to get this working for my electric skateboard where I want to have 2 segments of a single led strip – the one segment is for under my board, while the other segment is for the front of the board. I want to be able to independently run different patterns on the two segments. The one under the board will be more for effects, while the one on the front will be like a headlight and perhaps a KITT effect. I’m struggling to figure out how to adapt the code to do this. Any help would be appreciated.




    Hi songsta,

    Very cool that you’ve used the forum – I assume you’re the one that posted this comment – but I’ll paste my answer here as well (this is the better place to ask something like this anyway) … 

    I suppose there are a few ways we can accomplish this.
    I’d use the last 10 LEDs of the strip for the headlight and modify the code something like this.

    Set NUM_LEDS to the number of leds (40) you’d like to use for effects, and HEADLIGHT_LEDS to the number of LEDs you’d like to use for a headlight (10). Next in the setup() we set the headlights to white (or whichever color you prefer).

    Since the total led count = NUM_LEDS+HEADLIGHT_LED, we will have to use this when initializing the LEDs.
    After that, all effect functions work with NUM_LEDS, so they (theoretically) should only use LEDs zero to NUM_LEDS.
    I just had my first coffee for the day, so I hope I didn’t goof up the counting …

    For FastLED:

    #include "FastLED.h"
    #define NUM_LEDS 40
    #define HEADLIGHT_LEDS 10
    CRGB leds[NUM_LEDS];
    #define PIN 6 
    void setup()
      FastLED.addLeds<WS2811, PIN, GRB>(leds, NUM_LEDS+HEADLIGHT_LEDS).setCorrection( TypicalLEDStrip );
      // Set the "HeadLight LEDs to white
      for(int i=0;i<HEADLIGHT_LEDS;i++) {

    For NeoPixel:

    #include <Adafruit_NeoPixel.h>
    #define PIN 6
    #define NUM_LEDS 60
    #define HEADLIGHT_LEDS 10
    // Parameter 1 = number of pixels in strip
    // Parameter 2 = pin number (most are valid)
    // Parameter 3 = pixel type flags, add together as needed:
    // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
    // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
    // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
    // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
    Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS+HEADLIGHT_LEDS, PIN, NEO_GRB + NEO_KHZ800);
    void setup() {
      strip.begin();; // Initialize all pixels to 'off'
      // Set the "HeadLight LEDs to white
      for(int i=0;i<HEADLIGHT_LEDS; i++) {

    Hopefully this will get you started 

    Oh and pretty please post your end product – I’m curious what this will look like – it sounds awesome!



    Love to comment on Google it.

Viewing 8 posts - 61 through 68 (of 68 total)

You must be logged in to reply to this topic.