#include <FastLED.h>
// Wie viele LEds auf dem Streifen?
#define NUM_LEDS 120
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
const int side_height = 10;
const int side_length = 12;
// Bestimmung der Zeilen und
// This function sets up the leds and tells the controller about them
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(2000);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed$
FastLED.clear();
}
void loop() {
FastLED.clear();
for (int i = 0; i < side_length; i++) { //step through the columns
for (int j = 0; j < side_height; j++) { //step through the rows
leds[XY(i, j, side_height)] = CHSV(255 / side_length * i, 200, 255);
FastLED.show();
delay(40);
}
}
/*
for (int j = 0; j < NUM_LEDS; j++) { //step through the leds
leds[j] = CHSV(255 / NUM_LEDS * j, 0, 255);
FastLED.show();
delay(40);
fadeToBlackBy(leds, NUM_LEDS, 200);
} */
}
int XY(int x, int y, int height) {
int number;
if ((x % 2) == 0) { //checks if even
number = 120 - height * x - 10 + y;
} else {
number = 120 - height * x - y - 1;
}
return number;
}