Corrected time data types in esp8266 example
The millis() function returns unsigned longs, not longs.
This commit is contained in:
parent
f46d0011ee
commit
b85f4dc35c
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user