A basic example of using the mbed NXP LPC1768 Application Board with Exosite.

Dependencies:   C12832_lcd EthernetInterface HTTPClient LM75B MMA7660 RGBLed mbed-rtos mbed

Fork of exosite_http_example by Patrick Barrett

Files at this revision

API Documentation at this revision

Comitter:
maanenson
Date:
Wed Jan 21 08:24:54 2015 +0000
Parent:
4:d6e87aea518f
Commit message:
Updated to add temp, pots, and real uptime

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
LM75B.lib Show annotated file Show diff for this revision Revisions of this file
MMA7660.lib Show annotated file Show diff for this revision Revisions of this file
RGBLed.lib Show annotated file Show diff for this revision Revisions of this file
RgbLED.lib 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
diff -r d6e87aea518f -r 04490f27f83f EthernetInterface.lib
--- a/EthernetInterface.lib	Tue Jan 20 23:38:51 2015 +0000
+++ b/EthernetInterface.lib	Wed Jan 21 08:24:54 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#f6ec7a025939
+http://mbed.org/users/mbed_official/code/EthernetInterface/#d1ccbed7687a
diff -r d6e87aea518f -r 04490f27f83f LM75B.lib
--- a/LM75B.lib	Tue Jan 20 23:38:51 2015 +0000
+++ b/LM75B.lib	Wed Jan 21 08:24:54 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/chris/code/LM75B/#6a70c9303bbe
+http://developer.mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac
diff -r d6e87aea518f -r 04490f27f83f MMA7660.lib
--- a/MMA7660.lib	Tue Jan 20 23:38:51 2015 +0000
+++ b/MMA7660.lib	Wed Jan 21 08:24:54 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
+http://mbed.org/users/Sissors/code/MMA7660/#36a163511e34
diff -r d6e87aea518f -r 04490f27f83f RGBLed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RGBLed.lib	Wed Jan 21 08:24:54 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/rominos2/code/RGBLed/#b125e5a28295
diff -r d6e87aea518f -r 04490f27f83f RgbLED.lib
--- a/RgbLED.lib	Tue Jan 20 23:38:51 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/vandep01/code/RgbLED/#396b3f9574ea
diff -r d6e87aea518f -r 04490f27f83f main.cpp
--- a/main.cpp	Tue Jan 20 23:38:51 2015 +0000
+++ b/main.cpp	Wed Jan 21 08:24:54 2015 +0000
@@ -4,12 +4,18 @@
 #include "C12832_lcd.h"
 #include <FileSystemLike.h>
 #include <FileHandle.h>
+#include "LM75B.h"
 
+/* known issues:
+1. CIK becomes corrupted after updating bin files on mbed device -or- resets
+2. Does not read led1 yet to control LED1 on/off
+
+*/
 const char VENDOR[] = "exosite";
 const char MODEL[] = "mbed_lpc1768_appbrdv1";
 
 #define WRITE_ALIAS "temp"
-#define READ_ALIASES "?screen"
+#define READ_ALIASES "?screen&led1"
 
 char EXO_CIK_HDR[] = "X-Exosite-CIK: 0000000000000000000000000000000000000000\r\n";
 const char EXO_CIK_HDR_FMT[] = "X-Exosite-CIK: %s\r\n";
@@ -31,9 +37,16 @@
 LocalFileSystem localfs("local");
 
 static C12832_LCD lcd;
+LM75B tmp(p28,p27);
+
+AnalogIn   Pot1(p19);
+AnalogIn   Pot2(p20);
+DigitalOut Led1Out(LED1);
 
 int main()
 {
+    int uptime = 0;
+    
     run_time.start();
     send_timer.start();
 
@@ -106,11 +119,41 @@
         char *key, *value;
         char incomming_buffer[BUFFSIZE];
         char scratch[32];
+        char tmp_str[8]={0};
+        char uptime_str[8]={0};
+        char pot1_str[8]={0};
+        char pot2_str[8]={0};
+        
         HTTPMap read_map = HTTPMap(incomming_buffer, BUFFSIZE);
         HTTPMap write_map = HTTPMap();
         
-        write_map.put("tempa", "127");
-        write_map.put("uptime", "5");
+        if(tmp.open())
+        {
+            snprintf(tmp_str, 16, "%.2f", (float)tmp);
+            printf("[%f] temp: %s C\r\n", run_time.read(), tmp_str);
+            write_map.put("tempc", tmp_str);
+        }
+        else {
+            error("Temp Sensor not detected!\n");
+        }
+        
+        snprintf(pot1_str, 16, "%3.3f", Pot1.read()*100.0f);
+        printf("[%f] Pot1: %s %%\r\n", run_time.read(), pot1_str);
+        write_map.put("pot1", pot1_str);
+        
+        snprintf(pot2_str, 16, "%3.3f", Pot2.read()*100.0f);
+        printf("[%f] Pot2: %s %%\r\n", run_time.read(), pot2_str);
+        write_map.put("pot2", pot2_str);
+        
+        /*if(Pot1 > 0.3f) {
+            Led1Out = 1;
+        } else {
+            Led1Out = 0;
+        }*/
+        
+        snprintf(uptime_str, 16, "%d", uptime);
+        printf("[%f] Uptimer Counter: %s\r\n", run_time.read(), uptime_str);
+        write_map.put("uptime", uptime_str);
     
         http.setHeader(0,EXO_CIK_HDR);
         http.setHeader(1,EXO_ACCEPT_HDR);
@@ -145,7 +188,7 @@
         }
         
         printf("[%f] Completed in %f seconds.\r\n", run_time.read(), connection_timer.read());
-        
+        uptime++;
         wait(5);
     }
 
diff -r d6e87aea518f -r 04490f27f83f mbed-rtos.lib
--- a/mbed-rtos.lib	Tue Jan 20 23:38:51 2015 +0000
+++ b/mbed-rtos.lib	Wed Jan 21 08:24:54 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d
+http://mbed.org/users/mbed_official/code/mbed-rtos/#9387d4c49609
diff -r d6e87aea518f -r 04490f27f83f mbed.bld
--- a/mbed.bld	Tue Jan 20 23:38:51 2015 +0000
+++ b/mbed.bld	Wed Jan 21 08:24:54 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file