Hi! I´m new to neopixels and fastled coding. I am a LEGO collector and usually modify my sets with micro smd led. Now with neopixels I can do more.
I´m trying to create a starting sequence for the millennium falcon where I have two rows of 55 pixels each, the sequence should run once and then loop in a wave that creates the sensation that the engine is on.
I have the wave already running but been unable to figure out how to create and insert the starting sequence that should run like this:
- First row should turn on led 27 and then go from 26 to 0 and 28 to 54 one by one
- Second row should turn on led 82 then go from 83 to 109 and 81 to 55 one by one
any ideas what should I do? thanks in advance.
current code below:
#include <FastLED.h>
#define NUM_LEDS 110
#define LED_PIN 6
CRGB leds[NUM_LEDS];
uint8_t colorIndex[NUM_LEDS];
DEFINE_GRADIENT_PALETTE( mfengine_gp ) {
0, 1, 8, 87,
71, 23, 195, 130,
122, 186, 248, 233,
168, 23, 195, 130,
255, 1, 8, 87
};
CRGBPalette16 mfengine = mfengine_gp;
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(50);
FastLED.clear(); // clear all pixel data
}
void loop() {
//Creat a sin wave with period of 2 seconds (30bpm) to change the brightness of the strip
uint8_t sinBeat = beatsin8(10, 50, 255, 0, 0); //bpm, low brightness, high brightness,
uint8_t sinBeat1 = beatsin8(30, 50, 255, 0, 60);
// Color each pixel from the palette using the index from colorIndex[]
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette(mfengine, colorIndex[i], sinBeat);
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette(mfengine, colorIndex[i], sinBeat1);
}
EVERY_N_MILLISECONDS(25){
for (int i = 0; i < NUM_LEDS; i++) {
colorIndex[i]++;
}
}
FastLED.show();
}