// Dé avec ATtiny85 et matrice de LEDs 8x8 MAX-7219
// Allumage par BP de jeu et automaintien temporisé
// jfs59 2024
#include "DE_max.h"
#include <avr/pgmspace.h>
#define BP_lancer_DE PB4 // physical pin 4, PB4, A2 (pin definition for the ATtiny85)
#define Auto_alim PB3 // Verrou d'alimentation temporisé
unsigned long Talimentation = 0; // durée d'alimention sans remise a zéro
unsigned long Tmax = 20000; // Temps d'allumage max sans action en ms
void setup() {
// put your setup code here, to run once:
pinMode(Auto_alim, OUTPUT);
digitalWrite(Auto_alim,HIGH); // verrou alim
pinMode(BP_lancer_DE, INPUT);
pinMode(0, INPUT);
randomSeed(analogRead(0)); // randomize the seed
DE_init();
animation(3);
affichage_clear();
affiche_Cochon();
affichage_clear();
Talimentation = millis();
}
void loop() {
if (digitalRead (BP_lancer_DE) == HIGH) {
lancer_DE();
Talimentation = millis(); // raz du temps automaintien
}
if (millis() - Talimentation > Tmax) {
digitalWrite(Auto_alim, LOW); // extinction
}
attente();
}