I am having issues on trying to call the functions on my project. This part of the code:
client.println("");
client.println("");
client.println("");
client.println("");
client.println("");
if(readString.indexOf("relayon") ==0)//checks for on
{
activate();
}
if(readString.indexOf("relayoff") >0)//checks for on
{
deactivate();
}
was supposed to call the following function whenever I have clicked the button but it is not doing so. Can you please look at my code and help me figure this out. Thanks
if(readString.indexOf("relayon") ==0)//checks for on
{
activate();
}
if(readString.indexOf("relayoff") >0)//checks for on
{
deactivate();
}
The indexOf() function returns the position of the phrase in the String. It returns -1 if the phrase was not found. It is highly unlikely that the phrase relayon is at the start of the String obtained from the client.