aaa
Dependencies: AmbientLib EthernetInterface HDC1000 mbed-rtos mbed
Fork of AmbientExampleLPC1768 by
LPC1768で温度・湿度を測定し、IoTデーター可視化サービスAmbientに送ってグラフ化するサンプルです。 https://ambidata.io
main.cpp
- Committer:
- TakehikoShimojima
- Date:
- 2016-05-07
- Revision:
- 1:92ec0c561ee5
- Parent:
- 0:5e3c6c295d90
File content as of revision 1:92ec0c561ee5:
#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); } }