Corrected time data types in esp8266 example

The millis() function returns unsigned longs, not longs.
This commit is contained in:
Kenneth Finnegan 2017-04-25 20:39:09 -07:00
parent f46d0011ee
commit b85f4dc35c

View File

@ -34,7 +34,7 @@ const char* mqtt_server = "broker.mqtt-dashboard.com";
WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
unsigned long lastMsg = 0;
char msg[50];
int value = 0;
@ -120,7 +120,7 @@ void loop() {
}
client.loop();
long now = millis();
unsigned long now = millis();
if (now - lastMsg > 2000) {
lastMsg = now;
++value;