Simple demo of HTTPClient application. Should be able to use EthernetInterface or WiflyInterface.

Dependencies:   EthernetInterface HTTPClient mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
WiredHome
Date:
Sun Feb 02 18:16:51 2014 +0000
Commit message:
Simple demo of HTTPClient

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Sun Feb 02 18:16:51 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#6a67d2bddc7c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPClient.lib	Sun Feb 02 18:16:51 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/WiredHome/code/HTTPClient/#4ea5255c1b04
--- /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();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Sun Feb 02 18:16:51 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#f88660a9bed1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Feb 02 18:16:51 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file