#include "SPI.h" #include "Ethernet.h" byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address /*byte ip[] = { 192, 168, 0, 4 }; // ip in lan /*byte gateway[] = { 192, 168, 0, 1 }; // internet access via router byte subnet[] = { 255, 255, 255, 0 }; //subnet mask*/ EthernetServer server(80); //server port String readString; ////////////////////// void setup(){ pinMode(5, OUTPUT); //pin selected to control //start Ethernet Ethernet.begin(mac); Serial.println("ArduinoAll server LED test"); // so I can keep track of what is loaded } void loop(){ // Create a client connection EthernetClient client = server.available(); if (client) { while (client.connected()) { if (client.available()) { char c = client.read(); //read char by char HTTP request if (readString.length() < 100) { //store characters to string readString += c; //Serial.print(c); } //if HTTP request has ended if (c == '\n') { /////////////// Serial.println(readString); //print to serial monitor for debuging client.println("HTTP/1.1 200 OK"); //send new page client.println("Content-Type: text/html"); client.println(); client.println(""); client.println(""); client.println("ArduinoALL"); client.println(""); client.println(""); client.println("ArduinoAll Internet Button"); // DIY buttons client.println("

ON

"); client.println("

OFF

"); client.println(""); client.println(""); delay(1); //stopping client client.stop(); ///////////////////// control arduino pin if(readString.indexOf("on") >0)//checks for on { digitalWrite(5, HIGH); // set pin 5 high Serial.println("Led On"); } if(readString.indexOf("off") >0)//checks for off { digitalWrite(5, LOW); // set pin 5 low Serial.println("Led Off"); } readString=""; } } } } }