Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed
Fork of Sample_HTTPClient by
main.cpp
- Committer:
- WiredHome
- Date:
- 2014-02-02
- Revision:
- 0:fb5060c39dd1
- Child:
- 1:2e29a33cd918
File content as of revision 0:fb5060c39dd1:
#include "mbed.h"
#include "HTTPClient.h"
#include "EthernetInterface.h"
Serial pc(USBTX, USBRX);
EthernetInterface eth;
HTTPClient http;
char message[2000];
DigitalOut myled(LED1);
int main() {
pc.baud(460800);
printf("HTTP Client - Build " __DATE__ " - " __TIME__ "\r\n");
eth.init();
eth.connect();
while(1) {
myled = 1;
int ret = http.get("http://mbed.org/media/uploads/mbed_official/hello.txt", message, sizeof(message));
if (!ret) {
printf("Success - read %d characters.\r\n", strlen(message));
printf("%s\r\n", message);
}
myled = 0;
wait(10);
}
// eth.disconnect();
}
