Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: AmbientLib EthernetInterface HDC1000 mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:8ff3c1a54f88
- Child:
- 1:9aa62bdb3b84
diff -r 000000000000 -r 8ff3c1a54f88 main.cpp
--- /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);
+ }
+}
Ambient