Hi Guys,
The effect I am after is on this video at the 6-40 mark. Where the opposing theatre chase LEDs are different colours.
Cheers,
Davy.
It all goes too fast for me to figure out the effect you desire.
As I wrote earlier it is easier if you just show each led state as I did above.
Out of curiosity does this work with your 10 LEDS? You only have to change the data not the code.
I can't actually test it as I don't have the hardware.
#include <Adafruit_NeoPixel.h> #include <FastLED.h> #define LED_PIN 4 #define NUM_LEDS 9 #define NUM_COLOURS 6 #define NUM_REPEATS 1 // Define colours used //CRGB colourOn = CRGB(255, 0, 0), colourBack; //CRGB colourOff = CRGB(0, 0, 0); CRGB colourList[6] = {CRGB(55,55,55),CRGB(55,0,55),CRGB(0,55,55),CRGB(255, 0, 0),CRGB(0,255, 0),CRGB(0,0,255),}; CRGB leds[NUM_LEDS]; // Define times for colour on and colour off in millis int lengthOn=100, lengthOff = 100; int pattern[18][10] = {{1,0,0,0,0,0,0,0,0,2}, {0,1,0,0,0,0,0,0,2,0}, {0,0,1,0,0,0,0,2,0,0}, {0,0,0,1,0,0,2,0,0,0}, {0,0,0,0,1,2,0,0,0,0}, {0,0,0,0,2,1,0,0,0,0}, {0,0,0,2,0,0,1,0,0,0}, {0,0,2,0,0,0,0,1,0,0}, {0,2,0,0,0,0,0,0,1,0}, {2,0,0,0,0,0,0,0,0,1}, {0,2,0,0,0,0,0,0,1,0}, {0,0,2,0,0,0,0,1,0,0}, {0,0,0,2,0,0,1,0,0,0}, {0,0,0,0,2,1,0,0,0,0}, {0,0,0,0,1,2,0,0,0,0}, {0,0,0,1,0,0,2,0,0,0}, {0,0,1,0,0,0,0,2,0,0}, {0,1,0,0,0,0,0,0,2,0}}; void setup() { Serial.begin(9600); } void loop() { for (int i = 0; i < 18; i++) { // set color for every LED for (int j = 0; j < 10; j++) { leds[ colourList[ patterns[i][j] ] ]; } FastLED.show(); delay(lengthOn); } }
Mate,
I had another look at sketch and noticed in the Integer that "pattern" was singular and in the void loop it was plural. I removed the 's' in the void loop and the compiler downloaded, however, apart from the first LED lighting up Blue and staying on, nothing else happened. I then made "pattern" plural in each case but same result.
Davy.
Hi Guys. Regarding a previous issue with delay {which was part of a massive sketch} I have isolated the offending loop and put it in a smaller sketch. For some reason when it gets to LED[3]the delay doesn't activate and the LED stays HIGH. This continues for next 6 LEDS.
Any ideas?
Cheers,
Davy.
[code]
#include <Adafruit_NeoPixel.h>
#include <FastLED.h>
#define LED_PIN 4
#define NUM_LEDS 10
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() {
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(0, 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[9] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(1000);
leds[9] = CRGB(0, 0, 0); //Yellow LED
delay(1000);
}
[/code]
Really made a mess with the code!!
Tried again.
#include <Adafruit_NeoPixel.h> #include <FastLED.h> #define LED_PIN 4 #define NUM_LEDS 9 #define NUM_COLOURS 6 #define NUM_REPEATS 1 // Define colours used //CRGB colourOn = CRGB(255, 0, 0), colourBack; //CRGB colourOff = CRGB(0, 0, 0); CRGB colourList[6] = {CRGB(0,0,0),CRGB(255,0,0),CRGB(0,0,255),CRGB(255, 0, 0),CRGB(0,255, 0),CRGB(0,0,255),}; CRGB leds[NUM_LEDS]; // Define times for colour on and colour off in millis int lengthOn=100, lengthOff = 100; int patterns[18][10] = {{1,0,0,0,0,0,0,0,0,2}, {0,1,0,0,0,0,0,0,2,0}, {0,0,1,0,0,0,0,2,0,0}, {0,0,0,1,0,0,2,0,0,0}, {0,0,0,0,1,2,0,0,0,0}, {0,0,0,0,2,1,0,0,0,0}, {0,0,0,2,0,0,1,0,0,0}, {0,0,2,0,0,0,0,1,0,0}, {0,2,0,0,0,0,0,0,1,0}, {2,0,0,0,0,0,0,0,0,1}, {0,2,0,0,0,0,0,0,1,0}, {0,0,2,0,0,0,0,1,0,0}, {0,0,0,2,0,0,1,0,0,0}, {0,0,0,0,2,1,0,0,0,0}, {0,0,0,0,1,2,0,0,0,0}, {0,0,0,1,0,0,2,0,0,0}, {0,0,1,0,0,0,0,2,0,0}, {0,1,0,0,0,0,0,0,2,0}}; void setup() { Serial.begin(9600); } void loop() { for (int j = 0; j < 18; j++) { // set color for every LED for (int i = 0; i < 10; i++){ leds[i] = colourList[ patterns[j][i] ]; } FastLED.show(); delay(1000); } }
It is midnight so I will have to check your code tomorrow.
You can make your code nicer if you are using the Arduino IDE.
In the IDE click text with right mouse button and Select All and save as HTML
In your post make a few CRLF with the enter key where you want to insert the code.
Select the {;} in the top bar of your post.
Insert between CRLF control codes.
Hi Guys,
The effect I am after is on this video at the 6-40 mark. Where the opposing theatre chase LEDs are different colours.
This appears to be a different effect, it's difficult to see because of the speed but it appears that the effect is taking place with specific colours of LEDs. That is, the LED is always the same colour regardless of which way the "wave" is passing. So the whole effect is to send a pulse from each end to the other end and back over a series of pre-coloured LEDs.
Is that correct ?
Anything seems possible when you don't know what you're talking about.
Hi Guys. Regarding a previous issue with delay {which was part of a massive sketch} I have isolated the offending loop and put it in a smaller sketch. For some reason when it gets to LED[3]the delay doesn't activate and the LED stays HIGH. This continues for next 6 LEDS.
Any ideas?
It would be very difficult to study this problem in depth because it doesn't seem to be a problem with the code. That suggests that it's being caused by your LEDs, Arduino, wiring or something that we can't access for testing.
Anything seems possible when you don't know what you're talking about.
Hi Guys,
The effect I am after is on this video at the 6-40 mark. Where the opposing theatre chase LEDs are different colours.
Try this ...
Anything seems possible when you don't know what you're talking about.
Hi Guys. Regarding a previous issue with delay {which was part of a massive sketch} I have isolated the offending loop and put it in a smaller sketch. For some reason when it gets to LED[3]the delay doesn't activate and the LED stays HIGH. This continues for next 6 LEDS.
Any ideas?
Upon careful re-reading,it appears that you are failing to call FastLED.show() to re-light the changed set of LEDs.
If you look at the code for LED[3], it pauses but never displays because there is no call to FastLED.show().
Try adding in the missing calls and see if it heals itself 🙂
Anything seems possible when you don't know what you're talking about.
@will HaHa. I rewrote the sketch and it worked before I got your reply. I went over the original a few times and never noticed the second FastLed command was missing. Once I can accept but seven times!!!!!!!!!!
Original is now working too.
Call me cloth eyes.
;-}
@robotbuilder Hi Mate. Had to Google CRLF. All double Dutch to me. 😉 . Regarding the new code you sent, it compiles but doesn't run. The third LED (IE LED 2) comes on and stays HIGH but nothing else happens.
Cheers,
Davy.
You refer to them as Red LED and Yellow LED but they are all actually RGB LEDS.
I modified the code as suggested by @will and which you say you also fixed.
#include <Adafruit_NeoPixel.h> #include <FastLED.h> #define LED_PIN 4 #define NUM_LEDS 10 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() { leds[0] = CRGB(0,255,0); // GREEN FastLED.show(); delay(1000); leds[0] = CRGB(0, 0, 0); // CLEAR FastLED.show(); delay(1000); leds[1] = CRGB(255,0,0); // RED FastLED.show(); delay(1000); leds[1] = CRGB(0, 0, 0); // CLEAR FastLED.show(); delay(1000); leds[2] = CRGB(0,0, 255); //BLUE FastLED.show(); delay(1000); leds[2] = CRGB(0, 0, 0); //CLEAR FastLED.show(); delay(1000); leds[3] = CRGB(0, 255, 0); //LIGHT GREEN FastLED.show(); delay(1000); leds[3] = CRGB(0, 0, 0); //CLEAR delay(1000); leds[4] = CRGB(255, 255, 0); //YELLOW FastLED.show(); delay(1000); leds[4] = CRGB(0, 0, 0); //CLEAR delay(1000); leds[5] = CRGB(25, 55, 0); //VERY DARK GREEN FastLED.show(); delay(1000); leds[5] = CRGB(0, 0, 0); //CLEAR delay(1000); leds[6] = CRGB(105, 25, 0); //BROWN FastLED.show(); delay(1000); leds[6] = CRGB(0, 0, 0); // CLEAR delay(1000); leds[7] = CRGB(0, 95, 150); //BLUE FastLED.show(); delay(1000); leds[7] = CRGB(0, 0, 0); //CLEAR delay(1000); leds[8] = CRGB(255, 0, 200); //MAGENTA FastLED.show(); delay(1000); leds[8] = CRGB(0, 0, 0); //CLEAR delay(1000); leds[9] = CRGB(255, 0, 200); //MAGENTA FastLED.show(); delay(1000); leds[9] = CRGB(0, 0, 0); //CLEAR delay(1000); }
The output I get is,
@robotbuilder Hi Mate. You have done what I done and haven't added FastLed.show() in between clear and delay from LED 3 onward.
😉

