Show Posts
Pages: [1]
1  Topics / Home Automation and Networked Objects / Re: Pushing a html page to a client device when a push button is pressed on: September 10, 2012, 09:39:01 pm
Hi Team,


Please revert me back .....its quite urgent..


Thanks in advance
Jack
2  Topics / Home Automation and Networked Objects / Pushing a html page to a client device when a push button is pressed on: September 10, 2012, 02:53:51 am
Dear Arduino Team,

I started a new project, i have a device that will play html pages. Now i'm trying to implement a project that ....

when i press a push-button attached to Arduino ethernet shield ( acting as a server ) should push a html page to the specified client.

I got struct with the code. Please help me on code ASAP.

Thanks in advance
Regards,
Jack.


3  Topics / Home Automation and Networked Objects / Re: controlling servo motor over internet using erduino ethernet shield on: July 03, 2012, 10:59:21 am
Hey thankz for the code ...it really worked for my for my project with very little manipulations....it is very much helpful to me.. smiley

But i m not satisfied with the web interface that i look at .... if anyone can help me to use some push-buttons to give the control to servo to move, it could be helpful to run my project as i wish ....

Thankz once again to charalamposdoukas & zoomkat .. smiley-grin

i attached my code ,which was working 100% for my project...

Code:
#include <SPI.h>
#include <Ethernet.h>

#include <Servo.h>
Servo myservo1;  // create servo object to control a servo1
Servo myservo2;  // create servo object to control a servo2


byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x78, 0xEC }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port

String readString;

//////////////////////

void setup(){


  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  myservo1.write(90); //set initial servo1 position if desired
  myservo2.write(90); //set initial servo2 position if desired
 
  myservo1.attach(9);  //the pin for the servo1 control
  myservo2.attach(8);  //the pin for the servo2 control
  //enable serial data print
  Serial.begin(9600);
  Serial.println("server servo/pin 9,8 test 1.0"); // 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("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Arduino </H1>");
         
         //Servo1 movement
          client.println("<a href=\"/?right\"\">RIGHT</a>");
          client.println("<a href=\"/?center\"\">CENTER</a>");
          client.println("<a href=\"/?left\"\">LEFT</a>");
         
          //servo2 movement
          client.println("<a href=\"/?up\"\">UP</a>");
          client.println("<a href=\"/?mid\"\">MIDDLE</a>");
          client.println("<a href=\"/?down\"\">DOWN</a>");

          client.println("</BODY>");
          client.println("</HTML>");
 
          delay(100);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin

          if(readString.indexOf("left") >0)
          {
            myservo1.write(135);
            delay (50);         
            Serial.println(" Turn to Left");
          }
                   
          if(readString.indexOf("center") >0)
          {
            myservo1.write(90);
            delay (50);           
            Serial.println(" Turn to Center");
          }
          if(readString.indexOf("right") >0)
          {
            myservo1.write(45);
            delay (50);           
            Serial.println(" Turn to Right");
          }
         
         
         
         
          if(readString.indexOf("up") >0)
          {
            myservo2.write(135);
            delay (50);           
            Serial.println(" Move Upwards ");
          }
                   
          if(readString.indexOf("mid") >0)
          {
            myservo2.write(90);
            delay (50);
            Serial.println(" Move to Center");
          }
         
          if(readString.indexOf("down") >0)
          {
            myservo2.write(45);
            delay (50);           
            Serial.println(" Move downwards ");
          }
         
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}



 
4  Topics / Home Automation and Networked Objects / controlling servo motor over internet using erduino ethernet shield on: June 30, 2012, 02:45:12 am
Hi,

I want to start a project on Arduino. I m actually a newbie to the arduino.
Now getting into the project , i want to give a pan and tilt movement to a webcam through internet or intranet. i googled it and found that i need to the arduino board and arduino ethernet shield to get into action. I bought all the parts , started doing the project. I got strucked with the code.
I actually want control the servos by clicking a pushbutton in the webpage. i want to use two servos for the pan & tilt movement. Please help me on code .. please do the needful .

Thankz in advance,
Prawin.
Pages: [1]