Working
Dependencies: EthernetInterface HTTPClient mbed-rtos mbed
Fork of Sample_HTTPClient by
Diff: main.cpp
- Revision:
- 0:fb5060c39dd1
- Child:
- 1:e2d91c62f2b4
diff -r 000000000000 -r fb5060c39dd1 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 02 18:16:51 2014 +0000 @@ -0,0 +1,30 @@ +#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(); +}