#include <FastLED.h>
#define LEDPIN 14
#define NUMOFLEDS 150
const uint8_t kMatrixWidth = 16;
const uint8_t kMatrixHeight = 16;
const bool kMatrixSerpentineLayout = false;
CRGB leds[kMatrixWidth*kMatrixHeight];
int rgb_values[256][3] = {{233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}, {233, 196, 165}, {200, 169, 234}, {233, 202, 173}, {151, 165, 143}, {178, 109, 141}, {104, 137, 174}, {160, 115, 136}, {88, 77, 71}, {104, 67, 80}, {114, 116, 109}, {157, 149}, {177, 195, 159}, {192, 176, 159}, {153, 147, 157}, {98, 78, 79}, {184, 196, 182}};
void setup() {
Serial.begin(9600);
FastLED.addLeds<WS2812, LEDPIN, GRB>(leds, kMatrixWidth*kMatrixHeight);
for (int i = kMatrixHeight -1; i >=0 ; i--) {
for (int j = kMatrixWidth -1; j >=0; j--) {
int position = 255 - (i* kMatrixWidth + j);
Serial.println("" + String(rgb_values[position][0]) + ", " + String(rgb_values[position][1]) + ", " + String(rgb_values[position][2]));
leds[XY(j, i)] = CRGB (rgb_values[position][0] , rgb_values[position][1], rgb_values[position][2]);
FastLED.show();
}
}
}
int XY( int x, int y)
{
int i;
if( kMatrixSerpentineLayout == false) {
i = (y * kMatrixWidth) + x;
}
if( kMatrixSerpentineLayout == true) {
if( y & 0x01) {
// Odd rows run backwards
uint8_t reverseX = (kMatrixWidth - 1) - x;
i = (y * kMatrixWidth) + reverseX;
} else {
// Even rows run forwards
i = (y * kMatrixWidth) + x;
}
}
return i;
}
void loop() {
// for (int i = 0; i < kMatrixHeight; i++) {
// for (int j = 0; j < kMatrixWidth; j++) {
// leds[XY(j, i)] = CRGB ( 0, 0, 255);
// FastLED.show();
// }
// }
// for (int i = kMatrixHeight - 1; i >= 0; i--) {
// for (int j = kMatrixWidth - 1; j >= 0; j--) {
// leds[XY(j, i)] = CRGB ( 255, 0, 0);
// FastLED.show();
// }
// }
leds[XY(0, 0)] = CRGB ( 157, 149, 0);
FastLED.show();
// for (int i = 0; i <= kMatrixWidth*kMatrixHeight; i++) {
// leds[i] = CRGB ( 0, 0, 255);
// FastLED.show();
// delay(40);
// }
// for (int i = kMatrixWidth*kMatrixHeight; i >= 0; i--) {
// leds[i] = CRGB ( 255, 0, 0);
// FastLED.show();
// delay(40);
// }
}