Hi
I'm trying to do a Hello World Server but my problem is that I don't know the specific problem but I think it's start after void loop() , I need to figure out the problem .
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0x55 , 0x66 , 0x56 , 0x90 , 0xEE , 0x70 };
byte ip[] = { 192 , 168 , 0, 9 };
byte subnet[] = { 255 , 255 , 255 , 0 };
byte gateway[] = { 192 , 168 , 0 , 1 };
EthernetServer server(84);
void setup(){
Serial.begin(9600);
Ethernet.begin(mac,ip,gateway,subnet);
server.begin();
Serial.println(Ethernet.localIP());
Serial.println("Server test1");
}
void loop(){
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean CNT = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
}
if( c =='\n' && CNT){
client.println("HTTP/1.1 204 OK");
client.println("Content-Type:text/html");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<body>");
client.println("<h1>Hello World</h1>");
client.println("</body>");
client.println("</html>");
}
client.stop();
}
}
}
}
best ,