i'll let it run to see if it updates
..WiFi connected
IP address:
192.168.1.111
Received NTP Response
Unix time = 1439395623
Explore... Chat... Share...
Moderator: igrr
..WiFi connected
IP address:
192.168.1.111
Received NTP Response
Unix time = 1439395623
..WiFi connected
IP address:
192.168.1.111
Received NTP Response
Unix time = 1439395623
No NTP Response
#define tm1637_clk_pin 14
#define tm1637_data_pin 13
#include <ntp.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <TM1637.h>
#include <Ticker.h>
#include <Time.h>
bool startWiFi(void);
time_t getNTPtime(void);
void readLine(char buffer[], uint8_t size);
void digitalClockDisplay();
void toggleColon(void);
NTP NTPclient;
tm1637 display(tm1637_clk_pin, tm1637_data_pin);
Ticker clock;
bool colon = true;
bool updateTime = true;
#define GMT +5.5 //india standard time
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println();
while (!startWiFi()){delay(1500);}
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
display.setBrightness(4);
NTPclient.begin("time.nist.gov", GMT);
setSyncInterval(SECS_PER_HOUR);
setSyncProvider(getNTPtime);
clock.attach(0.5, toggleColon);
}
void loop() {
if (updateTime){
updateTime = false;
if (timeStatus() != timeNotSet)
digitalClockDisplay();
}
}
time_t getNTPtime(void)
{
return NTPclient.getNtpTime();
}
void digitalClockDisplay()
{
// digital clock display of the time
display.writeTime(hourFormat12(), minute(), colon);
colon = !colon;
}
bool startWiFi(void)
{
uint8_t i;
//check for persistent wifi connection
for (i=0;i<10;i++){
if (WiFi.status() == WL_CONNECTED) return true;
delay(500);
Serial.print(".");
}
/*didn't work: so ask user to enter credentials over Serial Port */
#define maxSSIDlength 20
#define maxPASSlength 40
char ssid[maxSSIDlength];
char pass[maxPASSlength];
//prompt the user for his ssid
Serial.print("Enter ssid name: ");
readLine(ssid, maxSSIDlength);
Serial.println();
Serial.print("Enter pass phrase: ");
readLine(pass, maxPASSlength);
Serial.println();
Serial.print("Attempting to Connect");
if (WiFi.begin(ssid, pass) != WL_CONNECTED) {
for (i=0;i<10;i++){
if (WiFi.status() == WL_CONNECTED) return true;
delay(500);
Serial.print(".");
}
}
Serial.print("Failed to connect to: ");
Serial.println(ssid);
Serial.print("using pass phrase: ");
Serial.println(pass);
return false;
}
void readLine(char buffer[], uint8_t size)
{
uint8_t i = 0;
char c;
do {
while (!Serial.available()){yield();} //wait for input
c = Serial.read();
Serial.write(c); //echo characters back to user.
if (c == '\r') break;
if (c != '\n')
buffer[i++] = c;
} while (i < size-1);
buffer[i] = '\0';
}
void toggleColon(void)
{
updateTime = true;
}
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]