code cleanup

This commit is contained in:
Siwat Sirichai 2019-08-21 19:53:07 +07:00
parent 300df03808
commit 1abc8bc03c
1 changed files with 2 additions and 6 deletions

View File

@ -18,18 +18,14 @@ unsigned long previousMillis = 0;
const long interval = 5000;
int cnt = 0;
ESP8266MQTTMesh mesh = ESP8266MQTTMesh::Builder(networks, mqtt_server, mqtt_port).setMqttAuth(mqtt_user, mqtt_password).setVersion(FIRMWARE_VER, FIRMWARE_ID).setMeshPassword(mesh_password).build();
,
void callback(const char *topic, const char *msg); //define initial callback
void callback(const char *topic, const char *msg);
void setup() {
Serial.begin(115200);
delay(1000);
mesh.setCallback(callback);
mesh.begin();
}
@ -37,7 +33,7 @@ void loop() {
if (! mesh.connected())return;
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
mesh.publish("", msg.c_str());
mesh.publish("/test","test");
previousMillis = currentMillis;
cnt++;
}