Hi sterretje.
This is the modified sketch. The differences are the extended patterns, and the "int patterns are now [60] [50].
Cheers,
Davy.
#include <Adafruit_NeoPixel.h>
#include <FastLED.h> // Fastled library access required for some commands.
#define LED_PIN 4
#define NUM_LEDS 21
#define NUM_COLOURS 6
#define NUM_REPEATS
#define NUM_REPEATS patdog
uint8_t hue = 0;
// Define colours used
//CRGB colourOn = CRGB(255, 0, 0), colourBack;
//CRGB colourOff = CRGB(0, 0, 0);
CRGB colourList[6] = {CRGB(0, 0, 0), CRGB(0, 255, 0), CRGB(0, 0, 255),CRGB(255, 0, 0),};
CRGB colourListdog[6] = {CRGB(0, 0, 0), CRGB(255, 255, 0), CRGB(0, 255, 0),};
CRGB colourListcat[6] = {CRGB(0, 0, 0), CRGB(0, 255, 0), CRGB(255, 0, 0),CRGB(0, 0, 255), };
CRGB leds[NUM_LEDS];
// Define times for colour on and colour off in millis
int lengthOn = 10, lengthOff = 10;
int patterns[60][50] = {{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0},
{0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0},
{0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0},
{0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0},
{0,0,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0},
{0,0,0,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,0,0,0,0,0,2},
{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
};
void setup() {
Serial.begin(9600);
// Setup FastLED object
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(150);
for (int j = 0; j < NUM_LEDS; ++j) {
leds[j] = colourList[0];
}
}
void loop() {
Serial.println(" " );
for (int j = 0; j < 30; j++)
{
Serial.println(j);
// set color for every LED
for (int i = 0; i < 25; i++) {
leds[i] = colourList[ patterns[j][i] ];
}
FastLED.show();
delay(100);
}
Serial.println(" " );
for (int j = 0; j < 30; j++)
{
Serial.println(j);
// set color for every LED
for (int i = 0; i < 25; i++) {
leds[i] = colourListcat[ patterns[j][i] ];
}
FastLED.show();
delay(100);
}
Serial.println(" " );
for (int j = 0; j < 30; j++)
{
Serial.println(j);
// set color for every LED
for (int i = 0; i < 25; i++) {
leds[i] = colourList[ patterns[j][i] ];
}
FastLED.show();
delay(100);
}
for (int j = 0; j < 3; j++)
{
Serial.println(j);
leds[0] = CRGB(255, 0, 0); //Green LED
leds[1] = CRGB(255, 0, 0); //Green LED
leds[2] = CRGB(255, 0, 0); //Green LED
leds[10] = CRGB(255, 0, 0); //Green LED
leds[11] = CRGB(255, 0, 0); //Green LED
leds[12] = CRGB(255, 0, 0); //Green LED
leds[13] = CRGB(255, 255, 0); //Green LED
leds[14] = CRGB(255, 0, 255); //Green LED
leds[15] = CRGB(0, 255, 0); //Green LED
leds[16] = CRGB(255, 0, 0); //Green LED
leds[17] = CRGB(255, 0, 0); //Green LED
leds[18] = CRGB(255, 255, 0); //Green LED
leds[19] = CRGB(255, 0, 255); //Green LE
leds[20] = CRGB(255, 0, 255); //Green LE
FastLED.show();
delay(300);
leds[0] = CRGB(0, 0, 0); //Green LED
leds[1] = CRGB(0, 0, 0); //Green LED
leds[2] = CRGB(0, 0, 0); //Green LED
leds[10] = CRGB(0, 0, 0); //Green LED
leds[11] = CRGB(0, 0, 0); //Green LED
leds[12] = CRGB(0, 0, 0); //Green LED
leds[13] = CRGB(0, 0, 0); //Green LED
leds[14] = CRGB(0, 0, 0); //Green LED
leds[15] = CRGB(0, 0, 0); //Green LED
leds[16] = CRGB(0, 0, 0); //Green LED
leds[17] = CRGB(0, 0, 0); //Green LED
leds[18] = CRGB(0, 0, 0); //Green LED
leds[19] = CRGB(0, 0, 0); //Green LED
leds[20] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(300);
}
for (int j = 0; j < 3; j++)
{
Serial.println(j);
leds[2] = CRGB(255, 0, 0); //Green LED
leds[3] = CRGB(0, 255, 0); //Red LED
leds[4] = CRGB(0, 0, 255); //Red LE
FastLED.show();
delay(500);
leds[2] = CRGB(0, 0, 0); //Green LED
leds[3] = CRGB(0, 0, 0); //Red LED
leds[4] = CRGB(0, 0, 0); //Red LE
FastLED.show();
delay(100);
}
for (int j = 0; j < 3; j++)
{
Serial.println(j);
leds[4] = CRGB(0, 0, 255); //Cyan LED
leds[5] = CRGB(255, 0, 0); //Yellow LED
leds[6] = CRGB(0, 255, 0); //Yellow LED
FastLED.show();
delay(500);
leds[4] = CRGB(0, 0, 0); // cyan
leds[5] = CRGB(0, 0, 0); //yellowLED
leds[6] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);
}
for (int j = 0; j < 4; j++)
{
Serial.println(j);
leds[6] = CRGB(255, 0, 0); //Green LED
leds[7] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Green LED
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);
}
for (int j = 0; j < 9; j++)
{
Serial.println(j);
leds[8] = CRGB(255, 0, 0); //Green LED
leds[9] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Green LED
leds[9] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);
}
{
for (int j = 0; j < 4; j++)
{
Serial.println(j);
leds[8] = CRGB(0, 255, 0); //Green LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);
leds[9] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[9] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);
}
for (int j = 0; j < 9; j++)
{
}
}
}