Go Down

Topic: push button to web link [SOLVED] (Read 2424 times) previous topic - next topic


Dec 01, 2012, 04:13 pm Last Edit: Dec 11, 2012, 12:56 am by psyazax Reason: 1
Hello to everyone

i know that almost everybody want to control pin's over the web but for me is other way around

it is possible to have 5 push button on arduino and when i press some of the buttons arduino to access web link ?

let say

push button 1  ->
push button 2  ->
push button 5  ->

the reason i need this is because i have web server with web site.. and from there im controling some hardwere

i was searching over internet 3 weeks to find something but i did not :/


You would probably use web client code on the arduino to send data in a get or post to the remote web server.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


Did you look at the two Web Client examples?  Should be fairly easy to adapt one to make the web requests you want.

Code: [Select]

IPAddress server(192,168,7,10);
 if (client.connect(server, 80)) {
   // Make a HTTP request:
   client.println("GET /link1.php HTTP/1.0");
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e


Dec 02, 2012, 10:45 pm Last Edit: Dec 02, 2012, 10:48 pm by Aries Reason: 1
Hey there.

This is my first contact with arduino and related devices.
This thread seems to at least partly contain a way to my target:
I have a home automation miniserver (www.loxone.com) which also can interpret UDP commands. So, I think about a way to build up a kind of (stand alone) single room controller, consisting of a simple keypad in each room, which sends an impuls to the arduino device whereas each key is intended to launch an UDP signal.

Is this possible and what devices would I have to purchase for such a project?

Thanks in advance for any hint, Aries.


thanks everybody for replaying

i make modification from this sketch


Code: [Select]

#include <SPI.h>
#include <Ethernet.h>
#include <Client.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:

// MAC address
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,0,50 };
byte server[] = { 192,168,0,100 }; // mio computer

Client client(server, 80);
// pin button:
const int button2Pin = 2;     // the number of the pushbutton pin
const int button3Pin = 3;

// variables will change:
int button2State = 0;     
int button2StateOld = 0; // variable for reading the pushbutton status
int button3State = 0;     
int button3StateOld = 0; // variable for reading the pushbutton status

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):

void setup() {

  // initialize the pushbutton pin as an input:
  pinMode(button2Pin, INPUT);
  pinMode(button3Pin, INPUT); 
    // start the Ethernet connection:
Ethernet.begin(mac, ip);
  // initialize serial:
  // initialize ethernet:
  // if connect show on serial:
  if (client.connect())
else {
  // if not connect:
  Serial.println("connection failed");

void loop ()
  loop1 ();
  loop2 ();

void loop1 ()
        button2State = digitalRead(button2Pin);
    // check if the pushbutton is pressed.
    // if it is, the buttonState is HIGH:
    if (button2State != button2StateOld)  {
                  if (button2State == HIGH){
                           Serial.println("pin2 high");
                           client.println("POST /link1.php");

          delay (500);//end delay before loop starts again
void loop2 ()
        button3State = digitalRead(button3Pin);
    // check if the pushbutton is pressed.
    // if it is, the buttonState is HIGH:
    if (button3State != button3StateOld)  {
                  if (button3State == HIGH){
                           Serial.println("pin3 high");
                           client.println("POST /link2.php");

          delay (500);//end delay before loop starts again

what do you think ? its good ? can i make improvements  ?



I have introduced our new project KSduino in the 'ksduino' topic of this forum group. You can connect you Arduino to the KSduino web site and monitor & control your device through internet.

It may be is interesting for you,

see the KSduino web site: http://ksduino.org  and the 'ksduino' topic: http://arduino.cc/forum/index.php/topic,136475.0.html
Best regards,
Kirill Scherba.

Go Up