Browse Source

поддержка ESP-01

pull/1/head
Vladimir Smagin 2 weeks ago
parent
commit
cbe81d2981
1 changed files with 12 additions and 6 deletions
  1. 12
    6
      tm1640-ntp.ino

+ 12
- 6
tm1640-ntp.ino View File

@@ -10,8 +10,13 @@
10 10
 
11 11
 #define ONBOARDLED 2 // Built in LED on ESP-12/ESP-07
12 12
 
13
-#define CLK D2
14
-#define DIO D3
13
+// ESP-12
14
+//#define CLK D2
15
+//#define DIO D3
16
+
17
+// ESP-01
18
+#define CLK D3
19
+#define DIO D9
15 20
 
16 21
 LM1640Display display(CLK, DIO);
17 22
 
@@ -71,15 +76,16 @@ void processSyncEvent(NTPSyncEvent_t ntpEvent) {
71 76
 void setup() {
72 77
   static WiFiEventHandler e1, e2, e3;
73 78
   Wire.begin();
79
+  pinMode(ONBOARDLED, OUTPUT); // Onboard LED
80
+  digitalWrite(ONBOARDLED, LOW); 
81
+  delay(1000);
82
+  digitalWrite(ONBOARDLED, HIGH); 
74 83
 
75 84
   //Serial.begin(115200);
76 85
   WiFi.mode(WIFI_STA);
77
-  WiFi.hostname("clock16");
86
+  WiFi.hostname("clock-x16");
78 87
   WiFi.begin(YOUR_WIFI_SSID, YOUR_WIFI_PASSWD);
79 88
 
80
-  pinMode(ONBOARDLED, OUTPUT); // Onboard LED
81
-  digitalWrite(ONBOARDLED, HIGH); // Switch off LED
82
-
83 89
   NTP.onNTPSyncEvent([](NTPSyncEvent_t event) {
84 90
     ntpEvent = event;
85 91
     syncEventTriggered = true;

Loading…
Cancel
Save