Hello,
I got a Problem when using the Webserver example together with an UDP Listener.
If i start the Webserver alone everything is fine.
Same happens when the UDP Listener is called alone.
But together i am only able to get the Webserver working when stripping it down. That means i can only have one IF case for the input buttons (as seen in the webserver example).
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println("<div align=center>");
client.print("<body style=background-color:lightblue>");
client.println("<font color=red><h1>HTML Testsite</font></h1>");
client.println("<hr/>");
client.println("<h1><font color='#2076CD'>Room</font color></h1>");
client.println("<hr />
");
client.println("<form method=GET>");
if (lon == true) {
client.println("<input type=submit value=light name=1 style=width:200;height:100;background-color:red;/>");
}else {
client.println("<input type=submit value=light name=0 style=width:200;height:100;background-color:lightgreen;>");
}
// --->> If this is left out everything works, even with UDP called !
// if (mon == true) {
// client.println("<input type=submit name=1 value=motor style=width:200;height:100;background-color:red>");
// }else{
// client.println("<input type=submit name=0 value=motor style=width:200;height:100;background-color:lightgreen>");
// }
//
client.println("</form></body></html>");
break;
If i do a second IF case for a second input type button, the arduino resets every second.
The UDP code is:
void udptest(){
int packetSize = Udp.available();
if(packetSize){
packetSize = packetSize - 8; // subtract the 8 byte header
Udp.readPacket(packetBuffer,1024, remoteIp, remotePort);
Serial.println(MAX_BUFFER_UDP);
for (int i=0;i<7;i++){
Serial.println(packetBuffer[i]);
}
}
}
And it is called in the main loop as
void loop() {
webserv();
// delay(1000);
udptest();
// delay(1000);
}
I have the DFRduino Ethernet shield attached to a Nano 3.0.
I am out of ideas, can anyone help me ?
greets