This example sends temperature and humidity data to Ambient through ethernet. (Japanese: IoT用のクラウドサービス「Ambient」にLPC1768とイーサーネットを使ってデーターを送信するサンプルです。Ambientはマイコンから送られたセンサーデーターを受信し、蓄積し、可視化(グラフ化)します。 https://ambidata.io)

Dependencies:   AmbientLib EthernetInterface HDC1000 mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
AmbientData
Date:
Sat May 07 01:42:05 2016 +0000
Child:
1:9aa62bdb3b84
Commit message:
Initial submission

Changed in this revision

Ambient.lib Show annotated file Show diff for this revision Revisions of this file
EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
HDC1000.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/Ambient.lib	Sat May 07 01:42:05 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/AmbientData/code/AmbientLib/#7dca16f75bae
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Sat May 07 01:42:05 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#097a9996f8d5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HDC1000.lib	Sat May 07 01:42:05 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/kenjiArai/code/HDC1000/#927110422689
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat May 07 01:42:05 2016 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "Ambient.h"
+#include "HDC1000.h"
+
+unsigned int channelId = 100;
+const char* writeKey = "ライトキー";
+AMBIENT ambient;
+
+HDC1000      hdc1000(p9,p10);
+
+int main() {
+    printf("start\r\n");
+
+    EthernetInterface eth;
+    eth.init();
+    eth.connect();
+
+    TCPSocketConnection socket;
+    ambient.init(channelId, writeKey, &socket);
+
+    printf("\n\rClient IP Address is %s\n\r", eth.getIPAddress());
+    printf("Ambient send to ch: %d\r\n", channelId);
+
+    while (true) {
+        float temp, humid;
+        char tempbuf[12], humidbuf[12];
+
+        hdc1000.get();
+        temp = hdc1000.temperature();
+        humid = hdc1000.humidity();
+
+        sprintf(tempbuf, "%2.1f", temp);
+        ambient.set(1, tempbuf);
+        sprintf(humidbuf, "%2.0f", humid);
+        ambient.set(2, humidbuf);
+        printf("Temp: %s C, Humid: %s %%\r\n", tempbuf, humidbuf);
+        
+        ambient.send();
+        
+        wait(30.0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Sat May 07 01:42:05 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat May 07 01:42:05 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file