Hi All,
     I am putting a sketch together for addressable LED's based on FastLED library. I would like to include a section where the LEDS light up and travel in opposite direction simultaneously. Any ideas?
Â
Thanks,
Davy.
@davy-ps
I'm not clear in my mind how any one LED will display two colours running in opposite directions at the same time.
Do you mean that all the odd numbers will be travelling one way and all the even numbers be travelling the opposite direction ?Â
Also, do you mean that only one LED "runs" in each direction or that multiple LEDs will be lit at the same time ?
Anything seems possible when you don't know what you're talking about.
Hi Will,
     I am after the effect shown in this YouTube video at mark 3.20 to 3.22. Where the LEDS illuminate at each end and move toward each other and continue past each other. Single colour is OK.
Â
Thanks,
Davy.
That should be fairly easy. I think that you'll find the example sketch 'Cylon' (included in the FastLED library examples) will give you a very good base for the effect you want.
Â
Anything seems possible when you don't know what you're talking about.
Essentially it would be following this sequence of patterns where 0 is LED off and 1 is LED on. You could store the pattern in an array and display each pattern in sequence with a delay in between.
Â
   0  1  2  3  4  5  6  7  8  9  10 11   LED number 1  0  0  0  0  0  0  0  0  0  0  0  0 2  1  0  0  0  0  0  0  0  0  0  0  1 3  0  1  0  0  0  0  0  0  0  0  1  0 4  0  0  1  0  0  0  0  0  0  1  0  0 5  0  0  0  1  0  0  0  0  1  0  0  0 6  0  0  0  0  1  0  0  1  0  0  0  0 7  0  0  0  0  0  1  1  0  0  0  0  0 8  0  0  0  0  0  1  1  0  0  0  0  0 9  0  0  0  0  1  0  0  1  0  0  0  0 10  0  0  0  1  0  0  0  0  1  0  0  0 11  0  0  1  0  0  0  0  0  0  1  0  0 12  0  1  0  0  0  0  0  0  0  0  1  0 13  1  0  0  0  0  0  0  0  0  0  0  0
Â
Â
That worked!!!!!!!!!! Thanks a lot Guys.
Â
Cheers,
Â
Davy.
Guys, if I can impose on your good nature again, I have noticed that the delay isn't being applied in one of the loops. IÂ have highlighted where it starts in red on the attached sketch. What happens is when LED [3] lights up it stays on for approximately twice as long as 0, 1 & 2. When the remaining LED's light they do the same as if there is no delay specified. IE light in sequence for twice as long as first three with no pause. So where it states {to pick one at random}
leds[5] = CRGB(0, 0, 0); //Yellow LED
delay(100);
It seems as if this is being ignored.
Any ideas?Â
Â
Cheers,
Davy.
Â
Â
Â
[code]
#include <Adafruit_NeoPixel.h>
#include <FastLED.h>
#define LED_PIN 4
#define NUM_LEDS 9
CRGB leds[NUM_LEDS];
uint8_t hue = 0;
void setup() {
// Setup Serial Monitor
Serial.begin(9600);
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(250);
}
void loop() {
for (int i = 0; i < NUM_LEDS; ++i) {
leds[i] = CHSV(hue + (i * 10), 255, 255);
}
//You can change the pattern speed here
EVERY_N_MILLISECONDS(300){
hue++;
}
FastLED.show();
leds[0] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[1] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);
leds[2] = CRGB(0,25, 125); //Blue LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);
leds[3] = CRGB(0,25, 125); //Blue LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);
leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[5] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[6] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[7] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[7] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[8] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[8] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[7] = CRGB(255,255,0); //Red LED
FastLED.show();
delay(00);
leds[7] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);
leds[6] = CRGB(0,25, 125); //Blue LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);
leds[5] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[3] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[2] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[1] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[0] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[0] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[1] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);
leds[2] = CRGB(0,25, 125); //Blue LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);
leds[3] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[5] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[6] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[7] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[7] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[8] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[8] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[7] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(00);
leds[7] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);
leds[6] = CRGB(0,25, 125); //Blue LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);
leds[5] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[3] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[2] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[1] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[0] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Yellow LED
delay(100);
leds[0] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(1000);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(1000);
leds[1] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(1000);
leds[1] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(1000);
leds[2] = CRGB(0,0, 255); //Blue LED
FastLED.show();
delay(1000);
leds[2] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(1000);
leds[3] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[3] = CRGB(0, 0, 0); //Yellow LED
delay(1000);
leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[4] = CRGB(0, 0, 0); //Yellow LED
delay(1000);
leds[5] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[5] = CRGB(0, 0, 0); //Yellow LED
delay(1000);
leds[6] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[6] = CRGB(0, 0, 0); //Yellow LED
delay(1000);
leds[7] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(1000);
leds[7] = CRGB(0, 0, 0); //Yellow LED
delay(1000);
leds[8] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(1000);
leds[8] = CRGB(0, 0, 0); //Yellow LED
delay(1000);
leds[0] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(255,0,0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(400);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0,0,255); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);
leds[7] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(400);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(40);
leds[8] = CRGB(0,0,255); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(40);
leds[7] = CRGB(0,255,0); //Red LED
FastLED.show();
delay(400);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0,0,255); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);
}
[/code]
It'll take a lifetime just to read that code 🙂 i've attached a new version (called davy3) where the commands are adapted to use a subroutine with only one line per LED as in the original. The blinkIt takes the following arguments: LED number, the 3 colour arguments and the delay time.
Please run this sketch to verify that it works (i don't have the required components). If it does work, please convert the rest of the commands to call the sub the same way the first few are done.
Then, please repost your sketch and ask your question again.
Note that the first leds[3] block in your original duplicates the leds[2] block above it. Is this intentional? It would seem to double the time and may relate to your stated problem.
Â
Anything seems possible when you don't know what you're talking about.
Hi Will,
     Your version of sketch gives same result. When it gets to blinkIt (3,0,25,125,100); and onward, the LED stays on for twice as long and there is no delay as 4,5,6,and 7 light up. It's as if the pin is high for the delay as well. Thanks so much for your time.
With the blinkIt command, is that a built in function of the library?  ;-}
Â
Cheers Mate,
Â
Davy.
Â
My assumption here, based on your code, is you have 9 leds? And that you want to change their colors according to some pattern. Where did your code come from? Is it some example for using fastLED? That source may make it easier for will or myself to produce code that works rather than trying to untangle what is a very long program when I suspect it can be made very short and clean using nested loops.
I find a description of the behavior required makes it easy to follow code logic or write it myself.
Personally I wouldn't bother with a library for such a simple display although that might depend on the circuit which you haven't attached.
The reason for my suggestion of using an array is you can easily modify the array without changing the code and you can see by looking at the array if it is the desired sequence of patterns.
Here is an example of an array. A 1 meaning color of whatever value and 0 some other color.
Â
int pattern[10][9] = {{0,0,0,0,0,0,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {1,0,0,0,0,0,0,0,1}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,1,0,0,0,0,0,1,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,1,0,0,0,1,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,0,1,0,1,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,0,0,1,0,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,0,1,0,1,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,1,0,0,0,1,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,1,0,0,0,0,0,1,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {1,0,0,0,0,0,0,0,1}}; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â void setup() { Â Â Â Serial.begin(9600); Â Â Â for (int i = 0; i < 10; i++) Â Â Â { Â Â Â Â Â Â Â for (int j = 0; j < 9; j++) Â Â Â Â Â Â Â { Â Â Â Â Â Â Â Â Â Â Â Serial.print ("Element at x["); Â Â Â Â Â Â Â Â Â Â Â Serial.print (i); Â Â Â Â Â Â Â Â Â Â Â Serial.print ("]["); Â Â Â Â Â Â Â Â Â Â Â Serial.print (j); Â Â Â Â Â Â Â Â Â Â Â Serial.print ("]:"); Â Â Â Â Â Â Â Â Â Â Â Serial.println ( pattern[i][j]); Â Â Â Â Â Â Â } Â Â Â } } void loop() { Â // put your main code here, to run repeatedly: }
Â
Â
Hi Will,
     Your version of sketch gives same result. When it gets to blinkIt (3,0,25,125,100); and onward, the LED stays on for twice as long and there is no delay as 4,5,6,and 7 light up. It's as if the pin is high for the delay as well. Thanks so much for your time.
Interesting, We're obviously missing something.
With the blinkIt command, is that a built in function of the library?  ;-}
No, it's a product of my own sloth. I'm too lazy and sloppy to write all that code and besides, it's so bulky that it's almost impossible to go through and debug it. Collecting common code which only requires a few parameters is a common technique in programming.
You can see the effect because after conversion, much of your code will fit on the same page/screen.
Anything seems possible when you don't know what you're talking about.
Given more details I think your code could be as simple as this (after the fastLed stuff in added).
int pattern[10][9] = {{0,0,0,0,0,0,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {1,0,0,0,0,0,0,0,1}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,1,0,0,0,0,0,1,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,1,0,0,0,1,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,0,1,0,1,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,0,0,1,0,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,0,1,0,1,0,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,0,1,0,0,0,1,0,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {0,1,0,0,0,0,0,1,0}, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â {1,0,0,0,0,0,0,0,1}}; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â void setup() { Â Â Â Serial.begin(9600); } void loop() { Â Â Â for (int i = 0; i < 10;i++){ Â Â Â Â Â Â Â for (int j = 0; j < 9; j++) Â Â Â Â Â Â Â { Â Â Â Â Â Â Â Â Â if (pattern[i][j]==1){ Â Â Â Â Â Â Â Â Â Â Â // leds[j] = CRGB(255, 0, 0); Â // RED COLOR Â Â Â Â Â Â Â Â Â Â Â Serial.print("R"); Â Â Â Â Â Â Â Â Â }else{ Â Â Â Â Â Â Â Â Â Â Â // leds[j] = CRGB(0, 0, 0); Â Â Â // OFF Â Â Â Â Â Â Â Â Â Â Â Serial.print("B"); Â Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } Â Â Â Â Â Â Â Serial.println(); Â Â Â Â Â Â Â delay(500); Â Â Â } }
Â
Â
I can't find any reason for the weirdness in delay, but there is an alternative to try out.
It looks like the FastLED class has a 'built-in' method called delay. So maybe try changing both of the delay commands in blinkIt to FastLED.delay and see if that works.
Also, unless you're using them, get rid of the extra code at the top of the loop()Â
for (int i = 0; i < NUM_LEDS; ++i) {
leds[i] = CHSV(hue + (i * 10), 255, 255);
}
//You can change the pattern speed here
EVERY_N_MILLISECONDS(300){
hue++;
}
These may be using interrupts.
Anything seems possible when you don't know what you're talking about.
Hi Will,
     I am after the effect shown in this YouTube video at mark 3.20 to 3.22. Where the LEDS illuminate at each end and move toward each other and continue past each other. Single colour is OK.
Try this as a simple solution to the original request ... (compiled but not tested)
Â
Anything seems possible when you don't know what you're talking about.