+ Test de pilotage Nixie
+
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
secrets.h
 | 
			
		||||
@@ -8,6 +8,8 @@
 | 
			
		||||
 | 
			
		||||
#include "hardware.h"
 | 
			
		||||
#include "nixie.h"
 | 
			
		||||
#include "horlogerie.h"
 | 
			
		||||
#include "secrets.h"
 | 
			
		||||
 | 
			
		||||
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
 | 
			
		||||
#include <RTClib.h>
 | 
			
		||||
@@ -46,7 +48,7 @@ void setup () {
 | 
			
		||||
  // sets the RTC with an explicit date & time, for example to set
 | 
			
		||||
  // January 21, 2021 at 3am you would call:
 | 
			
		||||
  // rtc.adjust(DateTime(2021, 1, 21, 3, 0, 0));
 | 
			
		||||
 | 
			
		||||
  initwifintp();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void loop () {
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1,3 @@
 | 
			
		||||
Firmware ESP32 pour mon horloge Nixie
 | 
			
		||||
 | 
			
		||||
Utilise les librairies : wifi, NTPClient, WiFiUdp
 | 
			
		||||
							
								
								
									
										49
									
								
								horlogerie.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								horlogerie.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
#include "horlogerie.h"
 | 
			
		||||
#include "Arduino.h"
 | 
			
		||||
#include "hardware.h"
 | 
			
		||||
#include "secrets.h"
 | 
			
		||||
 | 
			
		||||
#include <WiFi.h>
 | 
			
		||||
#include <NTPClient.h>
 | 
			
		||||
#include <WiFiUdp.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void initwifintp() {
 | 
			
		||||
 | 
			
		||||
  // Replace with your network credentials (see in 'arduino_secrets.h' file)
 | 
			
		||||
  char ssid[]          = SECRET_WIFI_SSID;
 | 
			
		||||
  const char* password = SECRET_WIFI_PASS;
 | 
			
		||||
 | 
			
		||||
  // Define NTP Client to get time
 | 
			
		||||
  WiFiUDP ntpUDP;
 | 
			
		||||
  NTPClient timeClient(ntpUDP);
 | 
			
		||||
 | 
			
		||||
  // Variables to save date and time
 | 
			
		||||
  String formattedDate;
 | 
			
		||||
  String dayStamp;
 | 
			
		||||
  String timeStamp;
 | 
			
		||||
 | 
			
		||||
    // Initialize Serial Monitor
 | 
			
		||||
    Serial.begin(115200);
 | 
			
		||||
    Serial.print("Connecting to ");
 | 
			
		||||
    Serial.println(ssid);
 | 
			
		||||
    WiFi.begin(ssid, password);
 | 
			
		||||
    while (WiFi.status() != WL_CONNECTED) {
 | 
			
		||||
      delay(100);
 | 
			
		||||
      Serial.print(".");
 | 
			
		||||
    }
 | 
			
		||||
    // Print local IP address and start web server
 | 
			
		||||
    Serial.println("");
 | 
			
		||||
    Serial.println("WiFi connected.");
 | 
			
		||||
    Serial.println("IP address: ");
 | 
			
		||||
    Serial.println(WiFi.localIP());
 | 
			
		||||
 | 
			
		||||
  // Initialize a NTPClient to get time
 | 
			
		||||
    timeClient.begin();
 | 
			
		||||
    // Set offset time in seconds to adjust for your timezone, for example:
 | 
			
		||||
    // GMT +1 = 3600
 | 
			
		||||
    // GMT +8 = 28800
 | 
			
		||||
    // GMT -1 = -3600
 | 
			
		||||
    // GMT 0 = 0
 | 
			
		||||
    timeClient.setTimeOffset(3600);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								horlogerie.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								horlogerie.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
/* fichier nixie.h */
 | 
			
		||||
#include "Arduino.h"
 | 
			
		||||
#include "hardware.h"
 | 
			
		||||
#include "secrets.h"
 | 
			
		||||
 | 
			
		||||
#include <WiFi.h>
 | 
			
		||||
#include <NTPClient.h>
 | 
			
		||||
#include <WiFiUdp.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void initwifintp();
 | 
			
		||||
							
								
								
									
										2
									
								
								secrets.h.default
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								secrets.h.default
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
#define SECRET_WIFI_SSID "lolo"
 | 
			
		||||
#define SECRET_WIFI_PASS "111lolo111"
 | 
			
		||||
		Reference in New Issue
	
	Block a user