void loop()
{
unsigned long currentMillis = millis();
unsigned long currentMillis2 = millis();
////////////////////////////////////////////////////////////////////////////////////////////////
// lecture entré machine à fumée
////////////////////////////////////////////////////////////////////////////////////////////////
Fumee_sensor_value = analogRead(pin_in_fumee) * 5000.0 / 1023.0 / 1000.0; // Convertit le signal 0.0 to 5.0 V
Fumee_value_float = ((((2.5 - Fumee_sensor_value) / 1.037)* 1000.0) -300 ); // calibration de corection selon carte amplificateur entre -2000 to 2000 mV (-300 = valeur de corection)
//Serial.println (Fumee_sensor_value);
// Appeler une fois la fonction de configuration actuelle, en mettant à jour le tableau des «LED»
gPatterns[gCurrentPatternNumber]();
// envoyer le réseau de «leds» sur la bande LED réelle
FastLED.show();
// insérer un délai pour garder le framerate modeste
FastLED.delay(3000/FRAMES_PER_SECOND);
// faire des mises à jour périodiques
EVERY_N_MILLISECONDS( 20 ) { gHue++; } // faire défiler lentement la "couleur de base" à travers l'arc-en-ciel
EVERY_N_SECONDS( 300 ) { nextPattern(); } // durée entre chaque changement
int compteur = 0 ;
while(compteur != 10) //tant que compteur est différent de 10
{
compteur ++ ; //On incrémente d’une unité
DmxSimple.write(1, 250);
}
////////////////////////// Temporisation de 1 seconde /////////////////////////
if (currentMillis - previousMillis >= 1000) {
previousMillis = currentMillis;
//for (int cycle = 145; cycle <= 246; cycle++){ // Simple loop to ramp up brightness
//DmxSimple.write(1, 155);
//DmxSimple.write(2, cycle); //Update DMX channel 1 to new brightness
//DmxSimple.write(4, 162);}
}
////////////////////////// Temporisation de 1 minute /////////////////////////
if (currentMillis2 - previousMillis2 >= 60000) {
previousMillis2 = currentMillis2;
}
}
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
void nextPattern()
{
// ajoutez-en un au numéro de modèle actuel et passez à la fin
gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}
void Cyclon() {
static uint8_t hue = 0;
// Faites d'abord glisser la led dans une direction
for(int i = 0; i < NUM_LEDS; i++) { // Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
FastLED.show(); // Afficher les leds
// leds[i] = CRGB::Black; // maintenant que nous avons montré les leds, remettez la ième led au noir
fadeall();
// Attendez un peu avant de faire le tour et recommencez
delay(3);
}
// Allez maintenant dans l'autre sens.
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(3);
}
}
void laser (){
int brightness;
//for (brightness = 145; brightness <= 246; brightness++){ ///* Simple loop to ramp up brightness
int compteur = 0 ;
while(compteur != 10) //tant que compteur est différent de 10
{
compteur ++ ; //On incrémente d’une unité
DmxSimple.write(1, 250);
}
// DmxSimple.write(2, brightness); /* Update DMX channel 1 to new brightness */
// DmxSimple.write(4, 162);}
}
void rainbow()
{
// FastLED's built-in rainbow generator
fill_rainbow( leds, NUM_LEDS, gHue, 7);
fadeToBlackBy( leds2, NUM_LEDS2, 10);
int pos = random16(NUM_LEDS2);
leds2[pos] += CHSV( gHue + random8(64), 200, 255);
fill_rainbow( leds2, NUM_LEDS2, gHue, 7);
}
void rainbowWithGlitter()
{
// built-in FastLED rainbow, plus some random sparkly glitter
rainbow();
addGlitter(80);
}
void addGlitter( fract8 chanceOfGlitter)
{
if( random8() < chanceOfGlitter) {
leds[ random16(NUM_LEDS) ] += CRGB::White;
leds3[ random16(NUM_LEDS3) ] += CRGB::White;
/* for (int cycle = 145; cycle <= 246; cycle++){ // Simple loop to ramp up brightness
DmxSimple.write(1, 120);
DmxSimple.write(2, cycle); //Update DMX channel 1 to new brightness
DmxSimple.write(4, 162);}*/
}
}
void confetti()
{
// random colored speckles that blink in and fade smoothly
fadeToBlackBy( leds, NUM_LEDS, 10);
int pos = random16(NUM_LEDS);
leds[pos] += CHSV( gHue + random8(64), 200, 255);
leds2[pos] += CHSV( gHue + random8(64), 200, 255);
}
void sinelon()
{
// a colored dot sweeping back and forth, with fading trails
fadeToBlackBy( leds, NUM_LEDS, 20);
int pos = beatsin16( 13, 0, NUM_LEDS-1 );
leds[pos] += CHSV( gHue, 255, 192);
leds2[pos] += CHSV( gHue, 255, 192);
}
void bpm()
{
// colored stripes pulsing at a defined Beats-Per-Minute (BPM)
uint8_t BeatsPerMinute = 120;
CRGBPalette16 palette = PartyColors_p;
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
for( int i = 0; i < NUM_LEDS; i++) { //9948
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
for( int i = 0; i < NUM_LEDS2; i++) {
leds2[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
}
for( int i = 0; i < NUM_LEDS3; i++) {
leds3[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
//leds3[i] = 0x70070;
}
for( int i = 0; i < NUM_LEDS4; i++) {
leds4[i] = 0x75FF80;}
}
}
void juggle() {
// eight colored dots, weaving in and out of sync with each other
fadeToBlackBy( leds, NUM_LEDS, 20);
byte dothue = 0;
for( int i = 0; i < 8; i++) {
leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255);
dothue += 32;
leds2[beatsin16( i+7, 0, NUM_LEDS2-1 )] |= CHSV(dothue, 200, 255);
dothue += 32;
leds3[i] = CRGB::Red;
}
}