Hi Experts,
after working through coursera's interface-with-arduino lecture I tried to following sketch
to access theinternet with a WiFi Shield
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
#include <SPI.h>
#include <Ethernet.h>
char ssid[] = "network-name";
char pass[] = "password";
int keyIndex = 0;
int status = WL_IDLE_STATUS;
char server[] = "www.google.com";
WiFiClient client;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while(!Serial) {
;
}
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);
delay(100000);
}
Serial.println("Connection sucessfull");
//printWifiStatus();
Serial.println("\nStarting connection to server....");
if (client.connect(server, 80)) {
Serial.println("connected to server");
client.println("GET /search?q=arduino HTTP/1.1"); //= suche nach Stichwort arduino
client.println("Host: www.google.com");
client.println("Connection: close");
client.println();
}
}
void loop() {
// put your main code here, to run repeatedly:
while (client.available()) {
char c = client.read();
Serial.write(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting from server.");
client.stop();
while (true);
}
}
But I only got "WiFi shield not present" and and the message (in german): Library not valid, no header files (.h) found in my sketch. I used the WiFi library from sketch to start.
????