Hi guys
i try to set up a webserver on my uno connected to a wifi shield to remotly control a LED over my pc.
The shield works well (can connect to my wlan etc).
so when i set up a webserver or somethin similar it seems that the client part of the code doesnt work or i do
something wrong. If i open the "easywebserver" example and put in my wlan pass etc.. it wont load the site on my browser (chrome).
also if i put in this code:
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "myNetwork"; // your network SSID (name)
char pass[] = "myPassword"; // your network password
int status = WL_IDLE_STATUS;
IPAddress server(74,125,115,105); // Google
// Initialize the client library
WiFiClient client;
void setup() {
Serial.begin(9600);
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
// don't do anything else:
while(true);
}
else {
Serial.println("Connected to wifi");
Serial.println("\nStarting connection...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
}
}
}
void loop() {
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}
I only get this at serial monitor:
"Attempting to connect to WPA network...
SSID: FRITZ!Box Fon WLAN XXXX
Connected to wifi
Starting connection...
disconnecting."
But nothing about client
Help me pls