Hi Guys,
I tried to modify the WiFi example "WiFIClientRepeater" and use it with my page (the original IP address was modified for our security.... if you want to know the real IP write to me...)
http://94.110.147.28/ard.aspx?user=admin&pwd=luca&mac=7ac4e1dfbba .
If you see the URL I pass 3 parameters (user, pwd and mac).
My ASP.NET page return a number (the content type is "TEXT") that could be 1, or 0 or -1.
So it's simple! I Thought!
Noooo!!!
The result of my sketch launched in monitor on Arduino2560 is a strange character ( ÿ ).
See below please!!
If I visit the page with a browser on a PC it works fine!!
What I wrong???
Thank you
bye
Attempting to connect to SSID: WiFiSSID
Connected to wifi
SSID: WiFiSSID
IP Address: 192.168.1.120
signal strength (RSSI):-68 dBm
connecting...
connected
disconnecting.
ÿ
connecting...
connected
disconnecting.
ÿ
connecting...
connected
disconnecting.
ÿ
and this is the sketch:
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "WiFiSSID";
char pass[] = "mypassword";
//int keyIndex = 0;
int status = WL_IDLE_STATUS;
IPAddress server(94,110,147,28);
WiFiClient client;
String location = "";
void setup() {
Serial.begin(9600);
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
while(true);
}
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(5000);
}
Serial.println("Connected to wifi");
printWifiStatus();
}
void loop() {
String pageValue = connectAndRead();
Serial.println(pageValue);
delay(5000);
}
String connectAndRead(){
Serial.println("connecting...");
if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /ard.aspx?user=admin&pwd=luca&mac=7ac4e1dfbba HTTP/1.1");
client.println("Host: 94.110.147.28");
client.println("Connection: close");
client.println();
char pag = client.read();
client.stop();
client.flush();
Serial.println("disconnecting.");
return String(pag);
}else{
return "connection failed";
}
}
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}