Update WaterishOS-minimal2.0.ino

This commit is contained in:
Siwat Sirichai 2019-08-09 11:20:55 +07:00
parent b55cc425e5
commit fe5db4ca13
1 changed files with 5 additions and 3 deletions

View File

@ -36,8 +36,10 @@ void collectdata(){
for(int sid=8;sid<13;sid++)sensorB[sid-8].tick(1000); for(int sid=8;sid<13;sid++)sensorB[sid-8].tick(1000);
} }
void updatemqtt(){ void updatemqtt(){
for() for(int counter;counter<=6;counter++)mqtt.publish("/waterishos/node"+nodename+"/flowrateA/"+counter,String(sensorA[counter].getCurrentFlowrate()));
} for(int counter;counter<=6;counter++)mqtt.publish("/waterishos/node"+nodename+"/volumeA/"+counter,String(sensorA[counter].getTotalVolume()));
for(int counter;counter<=6;counter++)mqtt.publish("/waterishos/node"+nodename+"/flowrateB/"+counter,String(sensorB[counter].getCurrentFlowrate()));
for(int counter;counter<=6;counter++)mqtt.publish("/waterishos/node"+nodename+"/volumeB/"+counter,String(sensorB[counter].getTotalVolume()));}
void setup(){ void setup(){
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
@ -47,7 +49,7 @@ void setup(){
//wait for it ... (Wait for Wifi Connection //wait for it ... (Wait for Wifi Connection
connectionattempt++; connectionattempt++;
delay(500); delay(500);
if(conbnectionattempt>=20){ if(connnectionattempt>=20){
online=false; online=false;
break(); break();
} }