Last active
December 14, 2015 19:08
-
-
Save tbraun89/5134108 to your computer and use it in GitHub Desktop.
Demonstration: This code hangs on all arduino versions after some time...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SPI.h> | |
| #include <Ethernet.h> | |
| #define GREEN_PIN 41 | |
| byte mac[] = { ... }; | |
| // google.de | |
| IPAddress server(173, 194, 69, 94); | |
| int port = 80; | |
| EthernetClient client; | |
| boolean ethernetAvailable; | |
| char testCharacter = ' '; | |
| void setup() { | |
| Ethernet.begin(mac); | |
| pinMode(GREEN_PIN, OUTPUT); | |
| digitalWrite(GREEN_PIN, HIGH); | |
| delay(1000); | |
| } | |
| void loop() { | |
| if (client.connected()) { | |
| if (client.available()) { | |
| char c = client.read(); | |
| testCharacter += c; | |
| } // no else | |
| digitalWrite(GREEN_PIN, LOW); | |
| } else { | |
| client.stop(); | |
| digitalWrite(GREEN_PIN, HIGH); | |
| delay(1000); | |
| if (client.connect(server, port)) { | |
| client.println("GET / HTTP/1.0"); | |
| client.println(); | |
| } // no else | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment