#include <Adafruit_NeoPixel.h>
#include <avr/pgmspace.h>
#include "giochi.h"
#define LED_PIN 3 // Pin connected to the NeoPixel strip
#define LED_COUNT 100 // Total number of LEDs in the strip
//uint32_t leddataindex_01[] = {0x00000000, 0x00FF0000}; //rosso
////uint32_t leddataindex_02[] = {0x00000000, 0x000000FF};//blue
//uint32_t leddataindex_03[] = {0x00000000, 0x00FFFF00};//giallo
//uint32_t leddataindex_04[] = {0x00000000, 0x0000FF00};//verde
//uint32_t leddataindex[] = {0x00000000, 0x00505050, 0x00A0A0A0, 0x00FFFFFF};
//uint32_t leddataindex15[] = {0x00000000, 0x00FFFF00};//giallo
//uint32_t leddataindex16[] = {0x00000000, 0x00FF0000}; //rosso
//uint32_t leddataindex17[] = {0x00000000, 0x0000FF00};//verde
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void Kit(uint32_t C1, uint32_t C2)
{
uint32_t leddataindex[] = {C1, C2};
for (uint16_t ciclo = 0; ciclo < 2; ciclo++)
{
for (uint16_t frame = 0; frame < 10; frame++)
{
for (uint16_t t = 0; t < LED_COUNT; t++)
{
uint32_t colore = leddataindex[ pgm_read_byte(&(ledarray17[frame][t])) ];
strip.setPixelColor(t, colore);
}
strip.show();
delay(20);
}
for (uint16_t frame = 9; frame > 0; frame--)
{
for (uint16_t t = 0; t < LED_COUNT; t++)
{
uint32_t colore = leddataindex[ pgm_read_byte(&(ledarray17[frame][t])) ];
strip.setPixelColor(t, colore);
}
strip.show();
delay(20);
}
}
}
void Neve()
{
uint32_t leddataindex[] = {0x00000000, 0x00505050, 0x00A0A0A0, 0x00FFFFFF};
for (uint16_t ciclo = 0; ciclo < 6; ciclo++)
for (uint16_t frame = 0; frame < 19; frame++)
{
for (uint16_t t = 0; t < LED_COUNT; t++)
{
uint32_t colore = leddataindex[ pgm_read_byte(&(ledarray[frame][t])) ];
strip.setPixelColor(t, colore);
}
strip.show();
delay(20);
}
}
void Diagonale_DX(uint32_t C1, uint32_t C2)
{
uint32_t leddataindex[] = {C1, C2};
for (uint16_t frame = 0; frame < 20; frame++)
{
for (uint16_t t = 0; t < LED_COUNT; t++)
{
uint32_t colore = leddataindex[ pgm_read_byte(&(ledarray16[frame][t])) ];
strip.setPixelColor(t, colore);
}
strip.show();
delay(20);
}
}
void Diagonale_SX(uint32_t C1, uint32_t C2)
{
uint32_t leddataindex[] = {C1, C2};
for (uint16_t frame = 0; frame < 20; frame++)
{
for (uint16_t t = 0; t < LED_COUNT; t++)
{
uint32_t colore = leddataindex[ pgm_read_byte(&(ledarray15[frame][t])) ];
strip.setPixelColor(t, colore);
}
strip.show();
delay(20);
}
}
void setup()
{
strip.begin();
strip.setBrightness(255);
strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
Kit(0x00000000, 0x0000FF00);
Kit(0x00000000, 0x00FF0000);
Kit(0x00000000, 0x00FFFFFF);
Kit(0x00000000, 0x00FFFF00);//giallo
strip.clear();
strip.show();
delay(200);
Neve();
strip.clear();
strip.show();
delay(200);
Diagonale_DX(0x00000000, 0x0000FF00);
delay(200);
Diagonale_SX(0x00000000, 0x0000FF00);
delay(200);
Diagonale_DX(0x00000000, 0x00FF0000);
delay(200);
Diagonale_SX(0x00000000, 0x00FF0000);
delay(200);
Diagonale_DX(0x00000000, 0x000000FF);
delay(200);
Diagonale_SX(0x00000000, 0x000000FF);
/*
for (uint16_t frame = 0; frame < 19; frame++)
{
for (uint16_t t = 0; t < LED_COUNT; t++)
{
uint32_t colore = leddataindex16[ pgm_read_byte(&(ledarray16[frame][t])) ];
strip.setPixelColor(t, colore);
}
strip.show();
delay(20);
}
*/
} /// FINE FINE FINE FINE FINE FINE FINE FINE FINE