Compare commits
	
		
			5 Commits
		
	
	
		
			bcc30e0f74
			...
			453e6dbd22
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					453e6dbd22 | ||
| 
						 | 
					daa915b5c7 | ||
| 
						 | 
					deedda25b8 | ||
| 
						 | 
					55ca79e431 | ||
| 
						 | 
					0f028e6757 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					secrets.h
 | 
				
			||||||
@@ -1,80 +1,220 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Created by Laurent CLaude
 | 
					 * Created by Laurent CLaude
 | 
				
			||||||
 | 
					 * https://www.laurentclaude.fr/
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This code is in license GPL v3
 | 
					 * My code is under license GPL v3
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Horloge Nixie basée sur ESP + module RTC-DS1307, avec fonctionnalités wifi pour synchro NTP
 | 
					 * Horloge Nixie basée sur ESP + module RTC-DS1307, avec fonctionnalités wifi pour synchro NTP
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "hardware.h"
 | 
					#include "hardware.h"
 | 
				
			||||||
#include "nixie.h"
 | 
					#include "secrets.h"
 | 
				
			||||||
 | 
					#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
 | 
				
			||||||
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
 | 
					#include <WiFiUdp.h>
 | 
				
			||||||
#include <RTClib.h>
 | 
					#include <RTClib.h>      // Date and time functions using a DS1307 RTC connected via I2C and Wire lib. https://github.com/adafruit/RTClib
 | 
				
			||||||
 | 
					#include <NTP.h>         // The NTP library allows you to receive time information from the Internet. https://github.com/sstaub/NTP
 | 
				
			||||||
// Les affectations physiques
 | 
					#include "nixie.h"       // Mes routines de pilotage d'affichage Nixie
 | 
				
			||||||
 | 
					 | 
				
			||||||
// event at to 14:45 (for tests)
 | 
					 | 
				
			||||||
uint8_t DAILY_EVENT_HH = 14; // event start time: hour
 | 
					 | 
				
			||||||
uint8_t DAILY_EVENT_MM = 45; // event start time: minute
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
RTC_DS1307 rtc;
 | 
					RTC_DS1307 rtc;
 | 
				
			||||||
 | 
					char daysOfTheWeek[7][12] = {"Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"};
 | 
				
			||||||
 | 
					int timeout = 120; // seconds to run for
 | 
				
			||||||
 | 
					bool wifiOK, ntpOK, rtcOK;
 | 
				
			||||||
 | 
					unsigned long LastRTCUpdate;    // le temps de dernière MAJ de l'horloge interne RTC
 | 
				
			||||||
 | 
					unsigned long LastNixieUpdate;  // le temps de dernière MAJ affichage Nixie
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char daysOfTheWeek[7][12] = {
 | 
					const long intervalRTCUpdate = 17000;   // 86400000 = 24 heures
 | 
				
			||||||
  "Dimanche",
 | 
					const long intervalNixieUpdate = 1000;  //     1000 =  1 seconde
 | 
				
			||||||
  "Lundi",
 | 
					 | 
				
			||||||
  "Mardi",
 | 
					 | 
				
			||||||
  "Mercredi",
 | 
					 | 
				
			||||||
  "Jeudi",
 | 
					 | 
				
			||||||
  "Vendredi",
 | 
					 | 
				
			||||||
  "Samedi"
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WiFiUDP wifiUdp;
 | 
				
			||||||
 | 
					NTP ntp(wifiUdp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					////////////       FONCTIONS         ////////////////
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
 | 
					bool initWIFI(){
 | 
				
			||||||
 | 
					 // is configuration portal requested?
 | 
				
			||||||
 | 
					  WiFiManager wm;
 | 
				
			||||||
 | 
					  wm.setConfigPortalTimeout(60);
 | 
				
			||||||
 | 
					  wm.setHostname("Horloge Nixie");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  bool res;
 | 
				
			||||||
 | 
					  //reset settings on startup if switch pressed
 | 
				
			||||||
 | 
					  if (! digitalRead(Rotary_SW)) {
 | 
				
			||||||
 | 
					    Serial.println("RAZ");
 | 
				
			||||||
 | 
					    wm.resetSettings();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  res = wm.autoConnect("NixieClockAP"); // Création d'un AP ou connexion mémorisée
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if(!res) {
 | 
				
			||||||
 | 
					    Serial.println("Failed to connect");
 | 
				
			||||||
 | 
					  } 
 | 
				
			||||||
 | 
					  else {
 | 
				
			||||||
 | 
					    //if you get here you have connected to the WiFi
 | 
				
			||||||
 | 
					    Serial.println("connected...yeey :)");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return(res);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool initRTC(){
 | 
				
			||||||
 | 
					  //// Initialisation RTC
 | 
				
			||||||
 | 
					  Serial.print("Initialisation de l'horloge interne RTC");
 | 
				
			||||||
 | 
					  rtcOK = rtc.begin();
 | 
				
			||||||
 | 
					  if (! rtcOK) {
 | 
				
			||||||
 | 
					    Wire.begin(I2C_SDA,I2C_SCL); // Broches (SDA,SCL) de l'I2C pour la RTC
 | 
				
			||||||
 | 
					    delay(1000);
 | 
				
			||||||
 | 
					    if (! rtc.begin()) {
 | 
				
			||||||
 | 
					      Serial.println(" --> RTC introuvable !");
 | 
				
			||||||
 | 
					      return (false);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else {
 | 
				
			||||||
 | 
					      Serial.println (" : OK");
 | 
				
			||||||
 | 
					      return (true);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  else {
 | 
				
			||||||
 | 
					    Serial.println(" : déjà démarrée !");
 | 
				
			||||||
 | 
					    return (true);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void printRTC(){
 | 
				
			||||||
 | 
					    //// Affichage du temps RTC en console série pour débug
 | 
				
			||||||
 | 
					  DateTime now = rtc.now();
 | 
				
			||||||
 | 
					  Serial.print ( " Heure de l'horloge interne (RTC) : " );
 | 
				
			||||||
 | 
					  Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
 | 
				
			||||||
 | 
					  Serial.print(" ");
 | 
				
			||||||
 | 
					  Serial.print(now.day(), DEC);
 | 
				
			||||||
 | 
					  Serial.print('/');
 | 
				
			||||||
 | 
					  Serial.print(now.month(), DEC);
 | 
				
			||||||
 | 
					  Serial.print('/');
 | 
				
			||||||
 | 
					  Serial.print(now.year(), DEC);
 | 
				
			||||||
 | 
					  Serial.print(" ");
 | 
				
			||||||
 | 
					  Serial.print(now.hour(), DEC);
 | 
				
			||||||
 | 
					  Serial.print(':');
 | 
				
			||||||
 | 
					  Serial.print(now.minute(), DEC);
 | 
				
			||||||
 | 
					  Serial.print(':');
 | 
				
			||||||
 | 
					  Serial.println(now.second(), DEC);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void initNTP(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Paramétrage NTP avec prise en compte de l'heure d'été pour la France
 | 
				
			||||||
 | 
					    Serial.print("Initialisation NTP");
 | 
				
			||||||
 | 
					    ntp.ruleDST("CEST", Last, Sun, Mar, 2, 120); // last sunday in march 2:00, timetone +120min (+1 GMT + 1h summertime offset)
 | 
				
			||||||
 | 
					    ntp.ruleSTD("CET", Last, Sun, Oct, 3, 60); // last sunday in october 3:00, timezone +60min (+1 GMT)
 | 
				
			||||||
 | 
					    ntp.begin();
 | 
				
			||||||
 | 
					    Serial.println(" : OK");
 | 
				
			||||||
 | 
					    //ntp.updateInterval(1000); // update every second
 | 
				
			||||||
 | 
					    Serial.print("Le temps Internet (NTP) indique : ");
 | 
				
			||||||
 | 
					    ntp.update();
 | 
				
			||||||
 | 
					    Serial.println(ntp.formattedTime("%A %d/%m/%Y %T")); // www dd/mm/yyyy hh:mm:ss
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void syncNTPtoRTC(){
 | 
				
			||||||
 | 
					  //// Récupération du temps Internet par NTP
 | 
				
			||||||
 | 
					  Serial.println ("Synchro temps NTP vers RTC :");
 | 
				
			||||||
 | 
					  Serial.print ("- récupération du temps Internet : ");
 | 
				
			||||||
 | 
					  ntp.update(); // récupération du temps NTP
 | 
				
			||||||
 | 
					  Serial.println(ntp.formattedTime("%A %d/%m/%Y %T")); // www dd/mm/yyyy hh:mm:ss
 | 
				
			||||||
 | 
					  //// Mise à jour du temps RTC de l'horloge locale
 | 
				
			||||||
 | 
					  Serial.print ( "- enregistrement du temps Internet dans l'horlore RTC" );
 | 
				
			||||||
 | 
					  rtc.adjust(DateTime(ntp.year(), ntp.month(), ntp.day(), ntp.hours(), ntp.minutes(), ntp.seconds()));
 | 
				
			||||||
 | 
					  Serial.println ( " : OK." );
 | 
				
			||||||
 | 
					  LastRTCUpdate = millis();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					///////////////////   setup      ////////////////////
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
void setup () {
 | 
					void setup () {
 | 
				
			||||||
  Serial.begin(115200);
 | 
					  //// Initialisation hardware 
 | 
				
			||||||
 | 
					  pinMode(Rotary_SW, INPUT_PULLUP);  // Encodeur rotatif : switch
 | 
				
			||||||
 | 
					  pinMode(Rotary_A, INPUT_PULLUP);   // Encodeur rotatif : voie A
 | 
				
			||||||
 | 
					  pinMode(Rotary_B, INPUT_PULLUP);   // Encodeur rotatif : voie B
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pinMode(BCD_D, OUTPUT);// D      Pour digits afficheurs nixie 1
 | 
				
			||||||
 | 
					  pinMode(BCD_C, OUTPUT);// C
 | 
				
			||||||
 | 
					  pinMode(BCD_B, OUTPUT);// B
 | 
				
			||||||
 | 
					  pinMode(BCD_A, OUTPUT);// A
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pinMode(BCD_D2, OUTPUT);// D      Pour digits afficheurs nixie 2
 | 
				
			||||||
 | 
					  pinMode(BCD_C2, OUTPUT);// C
 | 
				
			||||||
 | 
					  pinMode(BCD_B2, OUTPUT);// B
 | 
				
			||||||
 | 
					  pinMode(BCD_A2, OUTPUT);// A
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Démarrage de l'I2C :
 | 
				
			||||||
  Wire.begin(I2C_SDA,I2C_SCL); // Broches (SDA,SCL) de l'I2C pour la RTC
 | 
					  Wire.begin(I2C_SDA,I2C_SCL); // Broches (SDA,SCL) de l'I2C pour la RTC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // SETUP RTC MODULE
 | 
					  //// Initialisation de la liaison série
 | 
				
			||||||
  if (! rtc.begin()) {
 | 
					  Serial.begin(115200);
 | 
				
			||||||
    Serial.println("Couldn't find RTC");
 | 
					  Serial.println ("");
 | 
				
			||||||
    while (1);
 | 
					  Serial.println ("Liaison série OK");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  wifiOK = initWIFI(); // initialisation du wifi
 | 
				
			||||||
 | 
					  initNTP();   // récupération du temps Internet
 | 
				
			||||||
 | 
					  rtcOK = initRTC();   // initialisation de l'horloge interne
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					  if (wifiOK && rtcOK) {
 | 
				
			||||||
 | 
					    printRTC();       // Affichage du temps RTC en console série
 | 
				
			||||||
 | 
					    syncNTPtoRTC();   // Mise à l'heure de l'horloge RTC locale avec l'heure Internet
 | 
				
			||||||
 | 
					    printRTC();       // Affichage du temps RTC en console série
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  Serial.print("Pour info, le temps de compil : ");
 | 
				
			||||||
  // sets the RTC to the date & time on PC this sketch was compiled
 | 
					  Serial.print(__DATE__);
 | 
				
			||||||
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
 | 
					  Serial.println(__TIME__);
 | 
				
			||||||
 | 
					  Serial.println("Fin des initialisations.");
 | 
				
			||||||
  // sets the RTC with an explicit date & time, for example to set
 | 
					  printRTC();       // Affichage du temps RTC en console série
 | 
				
			||||||
  // January 21, 2021 at 3am you would call:
 | 
					  Serial.println("------------------------");
 | 
				
			||||||
  // rtc.adjust(DateTime(2021, 1, 21, 3, 0, 0));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					/////////////////     loop         //////////////////
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
void loop () {
 | 
					void loop () {
 | 
				
			||||||
  DateTime now = rtc.now();
 | 
					  unsigned long currentMillis = millis();
 | 
				
			||||||
  printTime(now);
 | 
					 | 
				
			||||||
  if (now.hour()   == DAILY_EVENT_HH &&
 | 
					 | 
				
			||||||
      now.minute() == DAILY_EVENT_MM) {
 | 
					 | 
				
			||||||
    Serial.println("It is on scheduled time");
 | 
					 | 
				
			||||||
    // TODO: write your code"
 | 
					 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    Serial.println("It is NOT on scheduled time");
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  delay(1000);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void printTime(DateTime time) {
 | 
					  // Mise à jour de l'affichage Nixie
 | 
				
			||||||
  Serial.print("Date : ");
 | 
					  if ((currentMillis - LastNixieUpdate >= intervalNixieUpdate) || (currentMillis < LastNixieUpdate)) {
 | 
				
			||||||
  Serial.print(time.year(), DEC);
 | 
					    LastNixieUpdate = currentMillis;
 | 
				
			||||||
  Serial.print('/');
 | 
					
 | 
				
			||||||
  Serial.print(time.month(), DEC);
 | 
					    DateTime now = rtc.now();
 | 
				
			||||||
  Serial.print('/');
 | 
					    int heu_d = (now.hour())/10;
 | 
				
			||||||
  Serial.print(time.day(), DEC);
 | 
					    int heu_u = (now.hour())%10;
 | 
				
			||||||
  Serial.print(" (");
 | 
					    int min_d = (now.minute())/10;
 | 
				
			||||||
  Serial.print(daysOfTheWeek[time.dayOfTheWeek()]);
 | 
					    int min_u = (now.minute())%10;
 | 
				
			||||||
  Serial.print(") - Heure : ");
 | 
					    int sec_d = (now.second())/10;
 | 
				
			||||||
  Serial.print(time.hour(), DEC);
 | 
					    int sec_u = (now.second())%10;
 | 
				
			||||||
  Serial.print(':');
 | 
					
 | 
				
			||||||
  Serial.print(time.minute(), DEC);
 | 
					    printNixie2(heu_d);
 | 
				
			||||||
  Serial.print(':');
 | 
					    printNixie(heu_u);
 | 
				
			||||||
  Serial.println(time.second(), DEC);
 | 
					    Serial.print(heu_d);
 | 
				
			||||||
 | 
					    Serial.print(heu_u);
 | 
				
			||||||
 | 
					    delay(1200);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printNixie2(99);
 | 
				
			||||||
 | 
					    printNixie(99);
 | 
				
			||||||
 | 
					    delay(000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printNixie2(min_d);
 | 
				
			||||||
 | 
					    printNixie(min_u);
 | 
				
			||||||
 | 
					    Serial.print(min_d);
 | 
				
			||||||
 | 
					    Serial.print(min_u);
 | 
				
			||||||
 | 
					    delay(1200);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printNixie2(99);
 | 
				
			||||||
 | 
					    printNixie(99);
 | 
				
			||||||
 | 
					    delay(1200);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Mise à jour de l'horloge interne RTC. Une fois par 24H
 | 
				
			||||||
 | 
					  if ((currentMillis - LastRTCUpdate >= intervalRTCUpdate) || (currentMillis < LastRTCUpdate)) {
 | 
				
			||||||
 | 
					    LastRTCUpdate = currentMillis;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    syncNTPtoRTC();   // Mise à l'heure de l'horloge RTC locale avec l'heure Internet
 | 
				
			||||||
 | 
					    printRTC();       // Affichage du temps RTC en console série
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										34
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								README.md
									
									
									
									
									
								
							@@ -1 +1,33 @@
 | 
				
			|||||||
Firmware ESP32 pour mon horloge Nixie
 | 
					Firmware pour mon horloge Nixie sur ESP32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Hardware utilisé
 | 
				
			||||||
 | 
					Voir mes schémas : https://code.laurentclaude.fr/laurent/Horloge_Nixie_Schematics
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Licence
 | 
				
			||||||
 | 
					Mon code est publié sous licence libre GNU GPL v3.
 | 
				
			||||||
 | 
					Mais tout n'est pas écrit par moi, consultez les licences correspondantes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Librairies utilisées :
 | 
				
			||||||
 | 
					WiFiManager - https://github.com/tzapu/WiFiManager
 | 
				
			||||||
 | 
					WiFiUdp     -
 | 
				
			||||||
 | 
					RTClib      - Date and time functions using a DS1307 RTC connected via I2C and Wire lib. https://github.com/adafruit/RTClib
 | 
				
			||||||
 | 
					NTP         - The NTP library allows you to receive time information from the Internet. https://github.com/sstaub/NTP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Personnalisation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## TODO :
 | 
				
			||||||
 | 
					Gestion des erreurs
 | 
				
			||||||
 | 
					- [X] WiFi : utiliser le Wifi Manager https://github.com/tzapu/WiFiManager
 | 
				
			||||||
 | 
					- [X] RTC  : en cas d'echec de récupération du temps Internet
 | 
				
			||||||
 | 
					- [ ] Pas/Perte de réseau
 | 
				
			||||||
 | 
					- [ ]
 | 
				
			||||||
 | 
					- [ ]
 | 
				
			||||||
 | 
					Fonctionnalités
 | 
				
			||||||
 | 
					- [X] Remise à zéro par pression d'un BP au démarrage : config Wifi,
 | 
				
			||||||
 | 
					- [X] Syncro de l'heure par internet et prise en compte heure d'été
 | 
				
			||||||
 | 
					- [ ] affichage de l'heure sur Nixie
 | 
				
			||||||
 | 
					- [ ] ajustement de l'heure par encodeur rotatif
 | 
				
			||||||
 | 
					- [ ] alarme réveil par buzer/HP ?
 | 
				
			||||||
 | 
					- [ ]
 | 
				
			||||||
 | 
					- [ ]
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										15
									
								
								boutsdecode.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								boutsdecode.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					// event at to 14:45 (for tests)
 | 
				
			||||||
 | 
					uint8_t DAILY_EVENT_HH = 14; // event start time: hour
 | 
				
			||||||
 | 
					uint8_t DAILY_EVENT_MM = 45; // event start time: minute
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DateTime now = rtc.now();
 | 
				
			||||||
 | 
					  printTime(now);
 | 
				
			||||||
 | 
					  if (now.hour()   == DAILY_EVENT_HH &&
 | 
				
			||||||
 | 
					      now.minute() == DAILY_EVENT_MM) {
 | 
				
			||||||
 | 
					    Serial.println("It is on scheduled time");
 | 
				
			||||||
 | 
					    // TODO: write your code"
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    Serial.println("It is NOT on scheduled time");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
							
								
								
									
										23
									
								
								hardware.h
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								hardware.h
									
									
									
									
									
								
							@@ -1,10 +1,21 @@
 | 
				
			|||||||
#include "Arduino.h"
 | 
					#include "Arduino.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// I2C (pour RTC)
 | 
					// I2C (pour RTC)
 | 
				
			||||||
  #define I2C_SDA 2
 | 
					  #define I2C_SDA 42
 | 
				
			||||||
  #define I2C_SCL 14
 | 
					  #define I2C_SCL 41
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Sorties BCD vers Nixie
 | 
					// Sorties BCD vers Nixie
 | 
				
			||||||
  #define BCD_A 16
 | 
					  #define BCD_A 15
 | 
				
			||||||
  #define BCD_B 5
 | 
					  #define BCD_B 16
 | 
				
			||||||
  #define BCD_C 4
 | 
					  #define BCD_C 17
 | 
				
			||||||
  #define BCD_D 0
 | 
					  #define BCD_D 18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #define BCD_A2 9
 | 
				
			||||||
 | 
					  #define BCD_B2 10
 | 
				
			||||||
 | 
					  #define BCD_C2 11
 | 
				
			||||||
 | 
					  #define BCD_D2 12  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Touches
 | 
				
			||||||
 | 
					  #define Rotary_A 35
 | 
				
			||||||
 | 
					  #define Rotary_B 36
 | 
				
			||||||
 | 
					  #define Rotary_SW 37 // switch vers la masse (R pullup interne) pour réinit du wifi au démarrage (choisi au pif)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										85
									
								
								nixie.cpp
									
									
									
									
									
								
							
							
						
						
									
										85
									
								
								nixie.cpp
									
									
									
									
									
								
							@@ -2,9 +2,9 @@
 | 
				
			|||||||
#include "Arduino.h"
 | 
					#include "Arduino.h"
 | 
				
			||||||
#include "hardware.h"
 | 
					#include "hardware.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void printNixie(byte a){
 | 
					void printNixie(int8_t a){
 | 
				
			||||||
  switch (a) {
 | 
					  switch (a) {
 | 
				
			||||||
    case 0 :
 | 
					    case 0:
 | 
				
			||||||
    digitalWrite(BCD_D, LOW);  //D
 | 
					    digitalWrite(BCD_D, LOW);  //D
 | 
				
			||||||
    digitalWrite(BCD_C, LOW);  //C
 | 
					    digitalWrite(BCD_C, LOW);  //C
 | 
				
			||||||
    digitalWrite(BCD_B, LOW);  //B
 | 
					    digitalWrite(BCD_B, LOW);  //B
 | 
				
			||||||
@@ -61,8 +61,85 @@ void printNixie(byte a){
 | 
				
			|||||||
    case 9:
 | 
					    case 9:
 | 
				
			||||||
    digitalWrite(BCD_D, HIGH); //D
 | 
					    digitalWrite(BCD_D, HIGH); //D
 | 
				
			||||||
    digitalWrite(BCD_C, LOW);  //C
 | 
					    digitalWrite(BCD_C, LOW);  //C
 | 
				
			||||||
    digitalWrite(BCD_B, HIGH); //B
 | 
					    digitalWrite(BCD_B, LOW);  //B
 | 
				
			||||||
    digitalWrite(BCD_A, LOW);  //A
 | 
					    digitalWrite(BCD_A, HIGH); //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 99:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D, HIGH); //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C, HIGH);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B, HIGH);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A, HIGH); //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void printNixie2(int8_t a){
 | 
				
			||||||
 | 
					  switch (a) {
 | 
				
			||||||
 | 
					    case 0:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, LOW);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, LOW);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, LOW);  //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 1:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, LOW);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, LOW);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, HIGH); //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 2:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, LOW);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, HIGH); //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, LOW);  //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 3:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, LOW);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, HIGH); //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, HIGH); //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 4:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, HIGH); //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, LOW);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, LOW);  //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 5:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, HIGH); //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, LOW);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, HIGH); //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 6:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, HIGH); //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, HIGH); //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, LOW);  //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 7:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, LOW);  //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, HIGH); //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, HIGH); //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, HIGH); //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 8:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, HIGH); //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, LOW);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, LOW);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, LOW);  //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 9:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, HIGH); //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, LOW);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, LOW);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, HIGH); //A
 | 
				
			||||||
 | 
					    break;
 | 
				
			||||||
 | 
					    case 99:
 | 
				
			||||||
 | 
					    digitalWrite(BCD_D2, HIGH); //D
 | 
				
			||||||
 | 
					    digitalWrite(BCD_C2, HIGH);  //C
 | 
				
			||||||
 | 
					    digitalWrite(BCD_B2, HIGH);  //B
 | 
				
			||||||
 | 
					    digitalWrite(BCD_A2, HIGH); //A
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										3
									
								
								nixie.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								nixie.h
									
									
									
									
									
								
							@@ -2,4 +2,5 @@
 | 
				
			|||||||
#include "Arduino.h"
 | 
					#include "Arduino.h"
 | 
				
			||||||
#include "hardware.h"
 | 
					#include "hardware.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void printNixie(byte a);
 | 
					void printNixie(int8_t a);
 | 
				
			||||||
 | 
					void printNixie2(int8_t a);
 | 
				
			||||||
							
								
								
									
										4
									
								
								secrets.h.default
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								secrets.h.default
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					// Change with your credentials and rename this file 'secrets.h'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SECRET_WIFI_SSID "YOUR_SSID"
 | 
				
			||||||
 | 
					#define SECRET_WIFI_PASS "YOUR_PASS"
 | 
				
			||||||
		Reference in New Issue
	
	Block a user