Hello.
My arduino Keeps freezing during the void setup() stage when I change this code:
if(readString.indexOf("?lighton") >0) //checks for on
{
digitalWrite(redLed, HIGH); // set pin 4 high
Serial.println("Led On");
}
else{
if(readString.indexOf("?lightoff") >0) //checks for off
{
digitalWrite(redLed, LOW); // set pin 4 low
Serial.println("Led Off");
}
}
to this:
if(readString.indexOf("?lighton") >0) //checks for on
{
digitalWrite(redLed, HIGH); // set pin 4 high
Serial.println("Led On");
}
else{
if(readString.indexOf("?lightoff") >0) //checks for off
{
digitalWrite(redLed, LOW); // set pin 4 low
Serial.println("Led Off");
}
}
// RADIO
if(readString.indexOf("?radioon") >0) //checks for on
{
radioStat = 1;
Serial.println("WEB: RADIO TURNED ON");
}
else{
if(readString.indexOf("?radiooff") >0) //checks for off
{
radioStat = 0;
Serial.println("WEB: RADIO TURNED OFF");
}
}
// END RADIO
the reason as to why I am confused is because the arduino freezes when it attempts to connect to the internet via ethernet in the void setup(), yet the code that causes the issue is at the very bottom of the void loop()…
On a rare occasion, it will work fine until I try to access the web server which will then cause the arduino to freeze completely…
Any suggestions?
Thanks