So, you've made code changes (or should have), and you'd like us to guess what you changed, and what serial output you are seeing, having added Serial.print() statements to debug the code. You did add them, right?
i attached the push button to pin 7 on the client
i attached 4 led to pin 6 , 7 , 8 and 9 on the server
the codes
the server
// FILENAME = LED2.ino
// SOURCE= http://www.instructables.com/id/Control-an-LED-over-the-internet-using-the-Arduino/
// Control an LED over the internet using the Arduino Ethernet Shield and Transistor
// http://www.instructables.com/id/Control-an-LED-over-the-internet-using-the-Arduino/
// code SOURCE= http://pastebin.com/CZ6J62qJ
#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>
// initialize the library with the numbers of the interface pins
Servo myservo; // create servo object to control a servo
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 177 }; // fixed IP addr in LAN
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
String readString;
//////////////////////
void setup(){
pinMode(6, OUTPUT); //pin selected to control LED
pinMode(7, OUTPUT); //pin selected to control LED
pinMode(8, OUTPUT); //pin selected to control LED
pinMode(9, OUTPUT); //pin selected to control LED
//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
//the pin for the servo co
//enable serial data print
Serial.begin(9600);
Serial.println("server LED test 1.0 ---- FILENAME = LED2.ino "); // so I can keep track
}
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("<HTML>");
client.println("<HEAD>");
client.println("<TITLE>Local network EX</TITLE>");
client.println("</HEAD>");
client.println("<BODY bgcolor='#FFFDD8'>");
client.println("<H1>Local network ex</H1>");
client.println("
");
client.println("TEST number 2");
client.println("
");
client.println("</BODY>");
client.println("</HTML>");
delay(1);
//stopping client
client.stop();
///////////////////// control arduino pin
if(readString.indexOf("?lightR") >0)//checks for on
{
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(6, HIGH);
Serial.println("LED RED");
}
if(readString.indexOf("?lightG") >0)//checks for off
{
digitalWrite(6, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(7, HIGH);
Serial.println("LED GREEN");
}
if(readString.indexOf("?lightY") >0)//checks for off
{
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
Serial.println("LED YELLOW");
}
if(readString.indexOf("?lightO") >0)//checks for off
{
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
Serial.println("LED ORANGE");
}
if(readString.indexOf("?A") >0)//checks for off
{
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
Serial.println("LED closed");
}
}
}
}
readString=""; //clearing string for next read
}
}
client
/*
Yun HTTP Client
This example for the Arduino Yún shows how create a basic
HTTP client that connects to the internet and downloads
content. In this case, you'll connect to the Arduino
website and download a version of the logo as ASCII text.
created by Tom igoe
May 2013
This example code is in the public domain.
http://arduino.cc/en/Tutorial/HttpClient
*/
#include <Bridge.h>
#include <HttpClient.h>
const int buttonPin = 7; // the number of the pushbutton pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
pinMode(buttonPin, INPUT);
// Bridge takes about two seconds to start up
// it can be helpful to use the on-board LED
// as an indicator for when it has initialized
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
digitalWrite(13, HIGH);
Serial.begin(9600);
while (!Serial); // wait for a serial connection
}
void loop() {
HttpClient client;
// Initialize the client library
if (buttonState == HIGH) {
Serial.println("work");
Serial.println();
// Make a HTTP request:
client.get("http://192.168.1.177?lightO");
if (client.available()){
Serial.println("Avilable");
Serial.println();
}
else {
Serial.println("connection failed");
Serial.println();
}
// if there are incoming bytes available
// from the server, read them and print them:
delay(500);
}
}