#include <FastLED.h>
#define LED_PIN 5
#define COLOR_ORDER GRB
#define CHIPSET WS2811
#define NUM_LEDS 50
#define BRIGHTNESS 100
#define FRAMES_PER_SECOND 60
CRGB leds[NUM_LEDS];
// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 4; // Connects to module's RX
static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX
//SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
// Create the Player object
//DFRobotDFPlayerMini player;
//delay pour les leds du tronc
void setup () {
//leds setup
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
//SOUNDS SETUP
// Init USB serial port for debugging
Serial.begin(9600);
// Init serial port for DFPlayer Mini
//softwareSerial.begin(9600);
// Start communication with DFPlayer Mini
//if (player.begin(softwareSerial)) {
// Serial.println("OK");
// Set volume to maximum (0 to 30).
// player.volume(0); //20
// Play the first MP3 file on the SD card
//player.play(1);
// } else {
// Serial.println("Connecting to DFPlayer Mini failed!");
// }
}
void loop() {
{ //musique
}
//attente
delay(3000);
//allumage leds
bottles();
delay(1000);
LedFin();
LedDebut();
delay(1000);
couleur_fin();
}
void bottles() {
{
leds[7] = CRGB(216, 100, 0);
delay(500);
FastLED.show();
leds[9] = CRGB(216, 100, 0);
delay(500);
FastLED.show();
leds[13] = CRGB(216, 100, 0);
delay(500);
FastLED.show();
leds[15] = CRGB(216, 100, 0);
delay(500);
FastLED.show();
leds[19] = CRGB(216, 100, 0);
delay(500);
FastLED.show();
leds[21] = CRGB(216, 100, 0);
delay(500);
FastLED.show();
leds[24] = CRGB(216, 100, 0);
delay(500);
FastLED.show();
}
}
void LedFin() {
for (int i = 28; i < NUM_LEDS; i++)
{
leds[i] = CRGB(216, 100, 0);
delay(100);
FastLED.show();
}
}
void LedDebut() {
for (int i = 28; i > 0; i--)
{
leds[i] = CRGB(216, 100, 0);
delay(100);
FastLED.show();
}
}
void couleur_fin() {
for (int i = 50; i < NUM_LEDS; i--) {
leds[i] = CRGB::Black;
delay(100);
FastLED.show();
}
}