blob: 021d0e7d7d9886823324e63d7a16ffa8a8531863 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <user_settings.h>
#include <ESP8266WiFi.h>
#include <ezTime.h>
Timezone CopenhagenTime;
void setup() {
Serial.begin(9600);
Serial.write(0x0C); // Clear display
Serial.print("VFD display\n");
Serial.print("Starting\n");
WiFi.setHostname(HOSTNAME);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.write(0x0C); // Clear display
Serial.printf("Hostname: %s\n", HOSTNAME);
Serial.printf("Connecting to: %s\n", WIFI_SSID);
while (WiFi.status() != WL_CONNECTED)
{
delay(1000);
Serial.print('.');
}
Serial.write(0x0C); // Clear display
Serial.println("Connected, IP address: ");
Serial.println(WiFi.localIP());
delay(1000);
waitForSync();
CopenhagenTime.setLocation("Europe/Copenhagen");
Serial.write(0x0C); // Clear display
}
void loop() {
// Get Unix epoch timestamp
char buffer [3];
sprintf(buffer,"%03d",ms());
String milliEpoch = String(now()) + buffer;
Serial.println(milliEpoch);
delay(50);
// https://github.com/ropg/ezTime#getting-date-and-time
// 16;36;15 Sat 16 Aug 33
String time_formatted = CopenhagenTime.dateTime("H:i:s D d M");
Serial.println(time_formatted);
events(); // Needed to update time continuously
}
|