Add uOLED-96-G1 C Sample Code.
[frickel.git] / projects / geeknamensschilder_c / hardware / libraries / Ethernet / examples / WebClient / WebClient.pde
blob74a609450551ee614702a68babd4484775d01f99
1 #include <Ethernet.h>
3 byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
4 byte ip[] = { 10, 0, 0, 177 };
5 byte server[] = { 64, 233, 187, 99 }; // Google
7 Client client(server, 80);
9 void setup()
11   Ethernet.begin(mac, ip);
12   Serial.begin(9600);
13   
14   delay(1000);
15   
16   Serial.println("connecting...");
17   
18   if (client.connect()) {
19     Serial.println("connected");
20     client.println("GET /search?q=arduino HTTP/1.0");
21     client.println();
22   } else {
23     Serial.println("connection failed");
24   }
27 void loop()
29   if (client.available()) {
30     char c = client.read();
31     Serial.print(c);
32   }
33   
34   if (!client.connected()) {
35     Serial.println();
36     Serial.println("disconnecting.");
37     client.stop();
38     for(;;)
39       ;
40   }