|
|
@ -4,6 +4,18 @@ |
|
|
|
|
|
|
|
|
#include "ledmask.h"
|
|
|
#include "ledmask.h"
|
|
|
|
|
|
|
|
|
|
|
|
/** LEDS **/ |
|
|
|
|
|
/**
|
|
|
|
|
|
* Coupe tout le strip de led. |
|
|
|
|
|
*/ |
|
|
|
|
|
void ledBlackAll() |
|
|
|
|
|
{ |
|
|
|
|
|
FastLED.clear(); |
|
|
|
|
|
FastLED.show(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** FIRE2012 **/ |
|
|
|
|
|
|
|
|
/*
|
|
|
/*
|
|
|
TODO: à adapter |
|
|
TODO: à adapter |
|
|
LED attached from pin 13 to ground |
|
|
LED attached from pin 13 to ground |
|
|
@ -11,7 +23,6 @@ |
|
|
10K resistor attached to pin 2 from ground |
|
|
10K resistor attached to pin 2 from ground |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
/** FIRE2012 **/ |
|
|
|
|
|
void Fire2012() |
|
|
void Fire2012() |
|
|
{ |
|
|
{ |
|
|
// Array of temperature readings at each simulation cell
|
|
|
// Array of temperature readings at each simulation cell
|
|
|
@ -67,6 +78,8 @@ void setup() { |
|
|
|
|
|
|
|
|
void loop() { |
|
|
void loop() { |
|
|
/** BOUTON **/ |
|
|
/** BOUTON **/ |
|
|
|
|
|
// TODO : temporaire car le but est d'appuyer sur le boutton pour lancer/couper les yeux
|
|
|
|
|
|
// pas de rester appuyé dessus
|
|
|
EVERY_N_MILLISECONDS(500) { |
|
|
EVERY_N_MILLISECONDS(500) { |
|
|
buttonState = digitalRead(BUTTON_PIN); |
|
|
buttonState = digitalRead(BUTTON_PIN); |
|
|
|
|
|
|
|
|
@ -78,10 +91,14 @@ void loop() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** LEDS **/ |
|
|
/** LEDS **/ |
|
|
// TODO : il faudra ici conditioner l'animation au fait que le button n'ai pas été pressé
|
|
|
|
|
|
// Add entropy to random number generator; we use a lot of it.
|
|
|
|
|
|
random16_add_entropy(random()); |
|
|
|
|
|
Fire2012(); // run simulation frame
|
|
|
|
|
|
FastLED.show(); // display this frame
|
|
|
|
|
|
FastLED.delay(1000 / LED_FPS); |
|
|
|
|
|
|
|
|
if (buttonState == HIGH) { |
|
|
|
|
|
// TODO : il faudra ici conditioner l'animation au fait que le button n'ai pas été pressé
|
|
|
|
|
|
// Add entropy to random number generator; we use a lot of it.
|
|
|
|
|
|
random16_add_entropy(random()); |
|
|
|
|
|
Fire2012(); // run simulation frame
|
|
|
|
|
|
FastLED.delay(1000 / LED_FPS); |
|
|
|
|
|
} else { |
|
|
|
|
|
// TODO : ne devrait pas être aussi simple, il faut que les yeux se fadent
|
|
|
|
|
|
ledBlackAll(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |