How to control 2 or more digital pins at a time using a switch in the dashboard?
I have multiple valves connected to each digital pin of esp8266 via MOSFET PWM, I would like close the 3 valves at a time with the help of a single switch.
The platform recognizes the variable type and shows the field according, for boolen values shows the state switch, for numbers or text shows a textfield, into the device’s api.
Thanks for your reply. But I’m still little confused with your hint. Below is my code for your reference. I would like to switch ON both the valves 3 & 5 with the press of a spargingmanual button in the console. And switch ON the valves 4 & 5 with the press of purgignmanual button.
All the valves are connected to digital pins of ESP8266 via PWM.
thing["spargingmanual"] << digitalPin(***********); // control valve 3 & valve 5
thing["purgingmanual"] << digitalPin(*************); // control valve 4 & valve 5
Just came across another hurdle. I would really appreciate if someone could help me out.
I wanted to control multiple valves connected to digital pins on a ESP8266 by using a single button in thinger.
And also wanted to show the status of the individual valves in thinger using on/off state switch.
I was able to achieve the first step but couldnt get the 2nd step working. Here’s my code for the thinger control.
thing["spargingmanual"] << [](pson &in){
if(in.is_empty()){
in=false; //when it is empty no changes are made
}else{
bool val=in;
if(val==true){
digitalWrite(15,!digitalRead(15)); //new value will be the opposite as before
digitalWrite(13,!digitalRead(13)); //new value will be the opposite as before
digitalWrite(12,!digitalRead(12)); //new value will be the opposite as before
digitalWrite(14,!digitalRead(14)); //new value will be the opposite as before
}
// delay(500); //this delay is the time it will take for the button to return to its common position (off)
in=false;
}
};
thing["purgingmanual"] << [](pson &in){
if(in.is_empty()){
in=false; //when it is empty no changes are made
}else{
bool val=in;
if(val==true){
digitalWrite(5,!digitalRead(5)); //new value will be the opposite as before
digitalWrite(14,!digitalRead(14)); //new value will be the opposite as before
}
// delay(500); //this delay is the time it will take for the button to return to its common position (off)
in=false;
}
};
The valves 10 to 15 are connected to sparging manual switch and valve 8 is connected to purging manual switch. If I hit the button sparging manual switch valves 10 to 15 should change the state to ON and so for the purging status.