Ethernet communication for biomedical purposes

Dependencies:   C12832_lcd EthernetNetIf HTTPClient_ToBeRemoved mbed

Fork of TwitterExample by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
TomDS
Date:
Mon Nov 25 13:07:13 2013 +0000
Parent:
4:9aff8f7be9b8
Commit message:
Temporary Publication - Biomedical Ethernet Communication

Changed in this revision

TwitterExample.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 9aff8f7be9b8 -r e68d9f6a8866 TwitterExample.cpp
--- a/TwitterExample.cpp	Mon Nov 25 11:37:32 2013 +0000
+++ b/TwitterExample.cpp	Mon Nov 25 13:07:13 2013 +0000
@@ -3,12 +3,22 @@
 #include "HTTPClient.h"
 #include "C12832_lcd.h"
  
+ // http://mbed.org/forum/mbed/topic/2238/
+ //
+ //
+ //
+ 
+
 EthernetNetIf eth; 
 HTTPClient http;
 C12832_LCD lcd;
+
+//char[] ip = "192.168.200.183";
+//char[] site = "http://"+ip+"/Ethernet/watmeetik.txt";
   
 int main() {
  
+  // SETUP ETHERNET CONNECTION
   lcd.printf("Start\n");
   wait(1);
   lcd.printf("\r\nSetting up...\r\n");
@@ -20,9 +30,11 @@
   }
   lcd.printf("\r\nSetup OK\r\n");
   
+  
+  // GET HTTP REQUEST
   HTTPText txt;
   
-  HTTPResult r = http.get("http://mbed.org/media/uploads/donatien/hello.txt", &txt);
+  HTTPResult r = http.get("http://192.168.200.183/Ethernet/watmeetik.txt", &txt);
   if(r==HTTP_OK)
   {
     lcd.printf("Result :\"%s\"\n", txt.gets()); 
@@ -32,10 +44,32 @@
     lcd.printf("Error %d\n", r);
   }
   
-  while(1)
-  {
+  wait(1);
+  lcd.cls();
+  lcd.printf("\nPOST\n");
+  wait(1);
+  
   
-  }
+    // POST HTTP REQUEST
+    HTTPMap msg;
+    msg["m1"] = "test1";
+    //http.basicAuth("gast","gast");
+    HTTPResult r2 = http.post("http://192.168.200.183/Ethernet/resultaten.txt", msg, NULL);
+    
+    if (r2 == HTTP_OK)
+    { 
+        lcd.printf("Update succesful\n");
+    }
+    else
+    {
+        printf("problem occured, returncode%d\n",r2);
+    }
+   
+  
+  
+  
+  while(1){}
+
   
   return 0;