08-05-2023, 09:25 PM
Hi,
you can send unlimited schedules.
You have to make some additions to the arduino code like the code below
On Virtuino IoT app use a Variable with the tag "schedule" to store the second schedule
you can send unlimited schedules.
You have to make some additions to the arduino code like the code below
Code:
//---- Enter all the Tags here. You have to use the same Tags on Virtuino variables
const char* pin0_tag= "schedule"; // tag for digital input
String scheduleHolder="";
unsigned long lastMillis = 0;
String char* pin1_tag = "schedule2";
String scheduleHolder2="";
//===================================================== sendPinStatus
void sendPinsStatus(){
sendValue(pin0_tag,scheduleHolder); // if you want send the schedule to VirtuinoIoT when the board is
sendValue(pin1_tag,scheduleHolder2);
connected
// add more here...
}
//===================================================== onValueReceived
void onValueReceived(String tag, String value){
Serial.println("Received: tag="+tag+ " value="+value);
if (tag== pin0_tag) {
Serial.println("Schedule received");
scheduleHolder = value;
}
else if (tag== pin1_tag){
Serial.println("Schedule2 received");
scheduleHolder2= value;
}
}
// call the getscheduleState with the String parameter"mySchedule"
boolean getscheduleState(byte clockDoW, byte clockHour, byte clockMinute, byte clockSecond, String mySchedule){
boolean returnedState=false;
JSONVar myObject = JSON.parse(mySchedule);
//........
}
On Virtuino IoT app use a Variable with the tag "schedule" to store the second schedule