/*attiny feu PN
22/11/2023
Dominique Hudry
Programme d'essai d'un feu clignotant pour PN simulant l'allumage
et l'extinction progressive des ampoules.
Utilisation de la bibliothèque LightDimmer
liens: https://www.locoduino.org/spip.php?article262
https://wokwi.com/projects/381904118121702401
Brochage ATtiny85
=|1 U 8|= VCC
=|2 7|=
=|3 6|= 1--> LED PN
GND =|4 5|= 0<-- BP
*/
#include <LightDimmer.h>
// Constantes d'E/S
const byte LED_PN = 1;
const byte BP = 0;
// Déclaration du clignoteur
LightDimmerSoft clignotant_LED_PN;
void setup() {
clignotant_LED_PN.begin(LED_PN, HIGH); // Initialisation du clignoteur
clignotant_LED_PN.setFadingTime(250);
clignotant_LED_PN.setBrighteningTime(250);
clignotant_LED_PN.setOnTime(200);
clignotant_LED_PN.setPeriod(900);
pinMode (BP, INPUT_PULLUP);// Déclaration de l'entrée BP
} // fin setup
void loop() {
LightDimmer::update();
if (digitalRead (BP) == LOW ) {// Clignotement si on appuie sur le BP
clignotant_LED_PN.startBlink();
}
else {
clignotant_LED_PN.off();
}
} // fin loop