Download libraries/Bridge/examples/HttpClient/HttpClient.ino from Beifengdo/Arduino-Development: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/datasets/Beifengdo/Arduino-Development/resolve/a9536d38154a7edd749fc80d712e93dbd9156f23/libraries/Bridge/examples/HttpClient/HttpClient.ino
- Command line
-
hf download hf://datasets/Beifengdo/Arduino-Development@a9536d38154a7edd749fc80d712e93dbd9156f23/libraries/Bridge/examples/HttpClient/HttpClient.ino
-
curl -L -o HttpClient.ino https://huggingface.co/datasets/Beifengdo/Arduino-Development/resolve/a9536d38154a7edd749fc80d712e93dbd9156f23/libraries/Bridge/examples/HttpClient/HttpClient.ino
1.13 kB
| /* | |
| Yún HTTP Client | |
| This example for the YunShield/Yún shows how create a basic | |
| HTTP client that connects to the internet and downloads | |
| content. In this case, you'll connect to the Arduino | |
| website and download a version of the logo as ASCII text. | |
| created by Tom igoe | |
| May 2013 | |
| This example code is in the public domain. | |
| http://www.arduino.cc/en/Tutorial/HttpClient | |
| */ | |
| void setup() { | |
| // Bridge takes about two seconds to start up | |
| // it can be helpful to use the on-board LED | |
| // as an indicator for when it has initialized | |
| pinMode(13, OUTPUT); | |
| digitalWrite(13, LOW); | |
| Bridge.begin(); | |
| digitalWrite(13, HIGH); | |
| SerialUSB.begin(9600); | |
| while (!SerialUSB); // wait for a serial connection | |
| } | |
| void loop() { | |
| // Initialize the client library | |
| HttpClient client; | |
| // Make a HTTP request: | |
| client.get("http://www.arduino.cc/asciilogo.txt"); | |
| // if there are incoming bytes available | |
| // from the server, read them and print them: | |
| while (client.available()) { | |
| char c = client.read(); | |
| SerialUSB.print(c); | |
| } | |
| SerialUSB.flush(); | |
| delay(5000); | |
| } | |