Review Ethernet Shield with Wiznet W5100 / TF Slot
The Ethernet Shield Wiznet W5100 uses the chip, which is reliable and its major competitor the Microchip ENC28J60. Good Ethernet Shield with Wiznet is having a well difuncida library in Arduino, moreover it works with all microcontrollers.
#include <Ethernet.h>
byte mac[]= {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Aqui vc coloca seu MAC
EthernetServer server(80); // iniciando servidor na porta 80
void setup()
Serial.begin(9600); // Abre comunicacao serial
Ethernet.begin(mac, ip); // define seu mac e IP
server.begin(); // inicia servidor
Serial.print(“server is at “); // imprime endereco IP na serial
Serial.println(Ethernet.localIP());
}
void loop()
EthernetClient client = server.available(); // procura clients conectados
if (client) {
Serial.println(“new client”);
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
if (c == ‘\n‘ && currentLineIsBlank) {
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Connnection: close”);
client.println();
client.println(“<!DOCTYPE HTML>”);
client.println(“<html>”);
client.println(“</html>”);
break;
}
if (c == ‘\n‘) {
currentLineIsBlank = true;
}
else if (c != ‘\r‘) {
currentLineIsBlank = false;
}
}
}
delay(1);
client.stop();
Serial.println(“client disonnected”);
}
}
URL : http://microembarcado.blogspot.kr/2012/09/review-ethernet-shield-com-wiznet-w5100.html
Authors :
COMMENTS