
HI
I’m trying to get the above effect from 8 Strips with 300 LEDs per strip.
Would this be possible without setting the strips as a Matrix, and using a software?.
Random meteor effect(say 50 random meteors at a time) down the 8 strips.
so far only managed to get the effect go down the strips(Horizontaly) not as in the drawing. Could some one shed some light on this please.
thanks for all the support I have been getting from every one.
What do you mean by ‘without setting the strip as a matrix’ ??
I understand that you are using an OctoWS2811 with Teensy3.1 are they wired up the way I mentioned in a previous comment ??
looping the ends, and connecting the whole thing as a Matrix and use a PIXEL software
1st… of course it is possible!!!
But for detailed sketch suggestions please answer about how is your setup currently wired up.
Hi Roy ,Yes all the 8 strips are connected to the teensy as you said before on the other posting (strip 1 to pin 2, strip 2 to pin 14 ect…)
Have you been able to run simple sketch and verify that all LEDs are working ?
Yes they work perfectly, but along the strip. Can run 8 identical effects along the line but sadly that’s where my capabilities ends.
Ok, very good !
I am currently adapting for you a sketch written by Mark Kriegsman showing how antialiasing works… here it is if you want to look at it and try yourself…
I am not a very strong programmer but I should be able to give you something soon !
Actually chances are someone else will beat me to it but that’s very much OK !!
Thanks Roy, please let me know how you got on please.
Hi @Chithru_Mihiripenna ,
I do not have a 8 X 300 LED array to test so you will have to play with this sketch. However, I have it working reasonably well on a 8X25 WS2812b array.
Here’s the constant and variable definitions I used…
#include <FastLED.h>
#define NUM_STRIPS 8
#define NUM_LEDS_PER_STRIP 25
CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP];
uint8_t Meteor_position[NUM_LEDS_PER_STRIP];
uint8_t Meteor_color[NUM_LEDS_PER_STRIP];
uint8_t Meteor_speed = 1;
uint8_t Meteor_fade = 2;
Here’s some instructions to add after your LED definition to initialise key variable
arrays:
for (int i=0; i<NUM_STRIPS; i++){
for (int j=0; j<NUM_LEDS_PER_STRIP; j++){
leds[i][j] = CRGB(0,0,0);
}
}
for (int k=0; k<NUM_LEDS_PER_STRIP; k++){
Meteor_position[k] = 0;
}
and here is my complete main loop:
Note there is no other functions but the main loop !!
void loop(){
random16_add_entropy( random());
for (int column = 0; column < NUM_LEDS_PER_STRIP; column++){
if (Meteor_position[column] > 0){ // If there is currently a meteor
in that column, update it’s position
Meteor_position[column] += Meteor_speed;
}
else if (random16() < 65){ // If there is no meteor, give it
~20% chance of a new meteor starting ! Needs revision for 300 LEDs !
Meteor_position[column] += Meteor_speed;
Meteor_color[column] = random8(25); // Random color selection for a new
meteor. Will select mostly white colored meteors
}
else continue; // No need to update any meteor on
the current column so continue direct to the next x column
if (Meteor_position[column] < 128){ // Update pixel only if it is the
first time through the 8 pixels
uint8_t pixel_fraction = (Meteor_position[column] & 0x0F) * 16; // extract
the ‘factional’ part of the meteor position
uint8_t pixel = (Meteor_position[column] & 0x70) / 16; // extract
the raw pixel number from the meteor position
switch(Meteor_color[column]){
case 0:
leds[pixel][column] = CRGB(pixel_fraction,0,0);
break;
case 1:
leds[pixel][column] = CRGB(0,pixel_fraction,0);
break;
case 2:
leds[pixel][column] = CRGB(0,0,pixel_fraction);
break;
case 3:
leds[pixel][column] = CRGB(pixel_fraction,pixel_fraction,0);
break;
case 4:
leds[pixel][column] = CRGB(0,pixel_fraction,pixel_fraction);
break;
case 5:
leds[pixel][column] = CRGB(pixel_fraction,0,pixel_fraction);
break;
default:
leds[pixel][column] = CRGB(pixel_fraction,pixel_fraction,pixel_fraction);
break;
}
}
}
for (int i=0; i<NUM_STRIPS; i++){
for (int j=0; j<NUM_LEDS_PER_STRIP; j++){
leds[i][j] -= CRGB(Meteor_fade,Meteor_fade,Meteor_fade);
}
}
FastLED.show();
}
Please do provide some feedback with regards to your progress or lack of it !!!
Good luck… //JPRoy
Hi Roy
I Can’t thank you enough, for the code. had a crack at It. I’m testing on a small rig as well, before the final build.
As you said did some changes to the code to see if I could compile and load it to the Teensy 3.1, but it does not compile. does not even high light an error it just say “compiling Error” could you be kind enough to see what have I done wrong please.
thanks
http://pastebin.com/GVeHnvtS
You did not define the leds array with the statements like…
FastLED.addLeds<NEOPIXEL, 2>(leds[0], NUM_LEDS_PER_STRIP); // 1st horizontal strip (the highest) etc… etc… for all strips !!!
Hi Roy
thanks for that , yes forgot the very basics!!
but even so still comes as compiling error.(do not Highlight)
could you kindly have a look at this for me please.
I’m so sorry to be a pain.
thanks
In setup, You are missing 2X right_curly_braces… this --> }
You have a ; after loop instead of a left_curly brace… this -> {
One too many right_curly_braces… this --> }
at the end on the main loop !!!
The sketch was designed of 8 strips not 3
It will not allow me to put {
void loop(){
random16_add_entropy( random());
it says " a function- definition is not allowed here before ‘{’ token"
But you must that is the correct syntax…
void loop() {
all the main loop code is here !!!
}
Look at every simple example in Arduino !!!
Your problem is simply because you have either too many or too few of the braces {}
I edited your pastebin as I mentioned and it compiled OK on my Arduino MEGA2560.
You should be able to do it !!
Hi Roy
managed to get the code to compile and upload to the teensy
can see random lines as I wanted to see(verticaly) but they don’t come down with the meteor effect. random coloure lines.
please have a look at the modified code to see how could i achieve this please.
thanks
Sorry, I will not troubleshoot the code for 3 strips… the code I provided should work for a 8 strips setup as you originally specified , the number of LEDs per strip is not so important.
Take your time and study the code, you may ultimately be able to adapt it yourself for 3 strips !!
Alternatively, connect 8 strings and try the sketch again. When you get there and still have a problem, I will be glad to help you.
My best regards, JP