UL Millis

This commit is contained in:
2020-10-22 16:42:37 +03:00
parent 8888a0a854
commit 92f523e37c
4 changed files with 9 additions and 5 deletions

View File

@@ -86,6 +86,7 @@ void setup() {
mqttClient.onMessage(onMqttMessage);
mqttClient.onPublish(onMqttPublish); */
mqttClient.setServer(mqtt_server, 1883);
mqttClient.setClientId("MidRoom");
pinMode(MOV_SENS, INPUT_PULLUP);
pinMode(P_SENS, OUTPUT);
@@ -138,7 +139,7 @@ void loop() {
if (digitalRead(MOV_SENS) != old_mov){
old_mov = digitalRead(MOV_SENS);
//Serial1.println(F("Change mov detected"));
mqttClient.publish("/home/midroom/move", 0, false, old_mov ? "1" : "0");
mqttClient.publish("/home/midroom/move", 1, false, old_mov ? "1" : "0");
}
if(cRun + 999 < millis()){
@@ -147,7 +148,7 @@ void loop() {
if(abs(adc - lastADC) > 50){
lastADC = adc;
itoa(adc, v, 10);
mqttClient.publish("/home/midroom/light", 0, false, v);
mqttClient.publish("/home/midroom/light", 1, false, v);
}
if(minCnt % 20 == 0){
co2 = mhz19.getCO2();
@@ -191,7 +192,7 @@ void loop() {
}
}
else if(minCnt % 10 == 0){
itoa(millis(), v, 10);
ultoa(millis(), v, 10);
if(mqttClient.connected()){
mqttClient.publish("/home/midroom/millis", 0, false, v);
// dtostrf(t, 5, 1,v);