Hi,
I am currently using an arduino connected to the internet to control it remotely and now i want to trigger it from a different arduino, simply by calling "http://139.59.206.133/xxxxxxxxxxxxxxxxx/update/V34?value=1".
When I type this into my browser it changes the value on the arduino i want to control.
But now I want to trigger this by pressing a button on a different arduino. Till now i found no way to call this html adress.
Can you help me, please
see the WebClient example
I have already tried so many things with client.connect and those things but none worked
I can actually connect to a page like www.google.com but the one that I want does not work.
For instance Google Maps doens't work either. Not even www.google.com/
Does anyone has an idea to make different clients possible?
I saw a nice answer today. The problem is on line XX. You used XXXXXXX instead of XXXXXX.
well I used the XXXXXX to censor a sensitive information
Sorry. I meant "The problem is in your code at line XX. You used XXXXXXX instead of XXXXXX."
I don't quite get your point
show your code
/*
This example connects to an unencrypted WiFi network.
Then it prints the MAC address of the WiFi shield,
the IP address obtained, and other network details.
Circuit:
- WiFi shield attached
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
#include <WiFi101.h>
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS; // the WiFi radio's status
WiFiClient client;
char server [] = "Google Maps";
// when you use this server it won't connect but with www.google.com it will
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while (true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(10000);
}
Serial.print("You're connected to the network");
}
void loop() {
if (client.connect(server, 80))
Serial.println("connected");
delay(10000);
}
JakobKrause:
I can actually connect to a page like www.google.com but the one that I want does not work.
For instance Google Maps doens't work either. Not even www.google.com/
Does anyone has an idea to make different clients possible?
you can't add path to variable 'server;. it is hostname that will be resolved to IP address at connect(). the url goes to first line sent to server. the HTTP protocol determines it. it is "GET /requested/url HTTP/1.1". and then the Host header is mandatory on next line.
look better at the WebClient example
Thanks so far.
I have edited my code but i still does not work.
Do you find any misktakes?
/*
This example connects to an unencrypted WiFi network.
Then it prints the MAC address of the WiFi shield,
the IP address obtained, and other network details.
Circuit:
- WiFi shield attached
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
#include <WiFi101.h>
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = ""; // your network SSID (name)
char pass[] = ""; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS; // the WiFi radio's status
WiFiClient client;
char server [] = "139.59.206.133";
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while (true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(10000);
}
Serial.print("You're connected to the network");
}
void loop() {
if (client.connect(server, 80))
Serial.println("connected");
client.println("GET /a166e9xxxxxxxxxxxxxxxxxx60e264/update/V34?value=1 HTTP/1.1");
client.println("Host: 139.59.206.133");
client.println("Connection: close");
client.println();
client.stop();
delay(10000);
}
Nevermind I just managed it.
Thank you very much
Have a nice day
Hi Jakob,
Was reading this item top to bottom and I would now really like to know HOW you managed it!
Could you please post the code that actually did work?
Thanks,
Loek
The last code, that I posted was actually working. I just messed up the authentication code.