Thank you ScruffR,
I have test both syntax unfortunately with the same result. I am also attaching the code. This is basic pool management starting relay modules and reading temperatures. Functions and variables are initiated and ready by IFTTT.
Do you have any idea where the problem could be?
Thank you
Jaroslav
#include "DS18B20_Pi.h"
#include <iostream>
#include <string>
int led1 = D1;
int led2 = D2;
int led3 = D3;
int led4 = D4;
int led5 = D5;
int led6 = D6;
int led7 = D7;
int led8 = D8;
char w1_address[15]; //temp akumulacka string
char w2_address[15]; //temp boiler string
char w3_address[15]; //temp boiler string
bool bublinky = false; // vririvka
bool filtrace = false; //aktivita filtrace
bool svetlo = false; //bazenove svetlo
int temp1=0;
int temp2=0;
int temp3=0;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT); //čistící robot
pinMode(led6, OUTPUT); //bublinky vířivka
pinMode(led7, OUTPUT); //Led světlo bazénu
pinMode(led8, OUTPUT); //filtrace
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
digitalWrite(led8, HIGH);
Particle.function("8CH_rele",ledToggle);
Particle.variable("Bublinky", bublinky);
Particle.variable("Svetlo", svetlo);
Particle.variable("Filtrace", filtrace);
Particle.variable("Teplota1", temp1);
Particle.variable("Teplota 2", temp2);
Particle.variable("Teplota 3", temp3);
Particle.variable("Test", "led8");
}
void loop()
{
strcpy(w1_address, "28-00000d2f9d04"); //cteni teploty
strcpy(w2_address, "28-00000c4223e5"); //cteni teploty
strcpy(w3_address, "28-00000d2fbcad"); //cteni teploty
DS18B20 w1Device (w1_address); // prevod typu promene z text na int
temp1 = w1Device.getTemp(); // prevod typu promene z text na int
DS18B20 w2Device (w2_address); // prevod typu promene z text na int
temp2 = w2Device.getTemp(); // prevod typu promene z text na int
DS18B20 w3Device (w3_address); // prevod typu promene z text na int
temp3 = w3Device.getTemp(); // prevod typu promene z text na int
}
int ledToggle(String command) {
if (command=="D1") {
digitalWrite(led1,LOW);
delay(1000);
digitalWrite(led1,HIGH);
return 1;
}
else if (command=="D2") {
digitalWrite(led2,LOW);
delay(1000);
digitalWrite(led2,HIGH);
return 2;
}
else if (command=="D3") {
digitalWrite(led3,LOW);
delay(1000);
digitalWrite(led3,HIGH);
return 3;
}
else if (command=="D4") {
digitalWrite(led4,LOW);
delay(1000);
digitalWrite(led4,HIGH);
return 4;
}
// Robot
else if (command=="D5") {
digitalWrite(led5,LOW);
delay(1000);
digitalWrite(led5,HIGH);
return 5;
}
else if (command=="D55") {
digitalWrite(led5,LOW);
delay(1000);
digitalWrite(led5,HIGH);
delay(3000);
digitalWrite(led5,LOW);
delay(1000);
digitalWrite(led5,HIGH);
return 5;
}
// bublinky
else if (command=="D6") {
digitalWrite(led6,LOW);
bublinky = true;
return 6;
}
else if (command=="D60") {
digitalWrite(led6,HIGH);
svetlo = false;
return 60;
}
// světlo
else if (command=="D7") {
digitalWrite(led7,LOW);
svetlo = true;
return 7;
}
else if (command=="D70") {
digitalWrite(led7,HIGH);
svetlo = false;
return 70;
}
else if (command=="D8") {
digitalWrite(led6,LOW);
bublinky = true;
delay(30000);
digitalWrite(led6,HIGH);
bublinky = false;
digitalWrite(led8,LOW);
filtrace = true;
return 8;
}
else if (command=="D80") {
digitalWrite(led8,HIGH);
filtrace = false;
return 80;
}
else {
return -1;
}
}