Browse Source

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

pull/1/head
Vladimir Smagin 6 months 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 @@

#define ONBOARDLED 2 // Built in LED on ESP-12/ESP-07

#define CLK D2
#define DIO D3
// ESP-12
//#define CLK D2
//#define DIO D3

// ESP-01
#define CLK D3
#define DIO D9

LM1640Display display(CLK, DIO);

@@ -71,15 +76,16 @@ void processSyncEvent(NTPSyncEvent_t ntpEvent) {
void setup() {
static WiFiEventHandler e1, e2, e3;
Wire.begin();
pinMode(ONBOARDLED, OUTPUT); // Onboard LED
digitalWrite(ONBOARDLED, LOW);
delay(1000);
digitalWrite(ONBOARDLED, HIGH);

//Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.hostname("clock16");
WiFi.hostname("clock-x16");
WiFi.begin(YOUR_WIFI_SSID, YOUR_WIFI_PASSWD);

pinMode(ONBOARDLED, OUTPUT); // Onboard LED
digitalWrite(ONBOARDLED, HIGH); // Switch off LED

NTP.onNTPSyncEvent([](NTPSyncEvent_t event) {
ntpEvent = event;
syncEventTriggered = true;

Loading…
Cancel
Save