Hi everyone, this is my first post although I've already received a lot of help through article comments which I am grateful for.
I don't have any experience in ws2812b projects using Uno, especially coding. I am doing my best to read/watch stuff about it online. So far, Tweaking4all has been my guide to start my project. From the materials needed up to making it work, this has helped me a lot. Now I'm on the part where I want to add a code for it. I tried to compile 2 existing codes for my project, The first part of the code was from arduino forums and the second one was from Hans (Meteor Rain). Although I really want a combination of Cyclon and Ranbow March, I think it may be advanced for me so I am doing a single effect for the 2 strips for now.
What I am using:
Arduino Uno & WS2812b (2 Strips / 30leds and 121leds)
I am getting this error message: expected unqualified-id before numeric constant from the 2nd line:
#define NUM_LEDS_PER_STRIP_A 121
#define NUM_LEDS_PER_STRIP_B 30
I know more errors will come after this one. I just want to know what caused this issue to happen.
Â
The entirety of the code that I was trying to compile:
// MultipleStripsInOneArray - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
// using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on three
// different pins, each strip will be referring to a different part of the single led array
#include <FastLED.h>
#define NUM_LEDS_PER_STRIP_A 121
#define NUM_LEDS_PER_STRIP_B 30
#define NUM_LEDS 151
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, 6>(leds, 121, NUM_LEDS_PER_STRIP_A);
FastLED.addLeds<WS2812B, 5>(leds, 30, NUM_LEDS_PER_STRIP_B);
int NUM_LEDS_PER_STRIP_A = 0;
int NUM_LEDS_PER_STRIP_B = 0;
}
void loop() {
meteorRain(0xff, 0xff, 0xff, 10, 64, true, 30);
}
void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {
if (Strip1Position==0) { fill_solid( leds1, NUM_LEDS_PER_STRIP_A, CRGB(0,0,0)); }
if (Strip2Position==0) { fill_solid( leds2, NUM_LEDS_PER_STRIP_B, CRGB(0,0,0)); }
// fade brightness all LEDs one step
for(int j=0; j<NUM_LEDS_PER_STRIP_A; j++) {
if( (!meteorRandomDecay) || (random(10)>5) ) {
leds1[j].fadeToBlackBy(meteorTrailDecay);
}
}
for(int j=0; j<NUM_LEDS_PER_STRIP_B; j++) {
if( (!meteorRandomDecay) || (random(10)>5) ) {
leds2[j].fadeToBlackBy(meteorTrailDecay);
}
}
// draw meteor
for(int j = 0; j < meteorSize; j++) {
if( ( i-j <NUM_LEDS_PER_STRIP_A) && (i-j>=0) ) {
leds1[i-j] = CRGB(red, green, blue);
}
}
for(int j = 0; j < meteorSize; j++) {
if( ( i-j <NUM_LEDS_PER_STRIP_B) && (i-j>=0) ) {
leds2[i-j] = CRGB(red, green, blue);
}
}
FastLED.show();
delay(SpeedDelay);
if(NUM_LEDS_PER_STRIP_APosition<NUM_LEDS_PER_STRIP_A+NUM_LEDS_PER_STRIP_A) {
Strip1Position++;
}
else
{
Strip1Postion = 0;
}
if(NUM_LEDS_PER_STRIP_BPosition<NUM_LEDS_PER_STRIP_B+NUM_LEDS_PER_STRIP_B) {
Strip2Position++;
}
else
{
Strip2Position = 0;
}
}
}
}