labs_3gim_sample_2

回路

mbed(LPC1768)とブレッドボード、温度センサ等で下記の回路を組む。

demo_3g_sch2.png


プログラム

#include "mbed.h"

const char *Header = "\"X-ApiKey: API_KEY$r$nContent-Type: text/csv$r$n\"";

Serial sePort(p9, p10); // with 3GIM
Serial pcPort(USBTX, USBRX); // with PC
AnalogIn ain(p19); // LM61BIZ Vout
DigitalOut myled(LED1);

void uploadCloud(float t) {
  sePort.printf(PostCmd);
   sePort.printf("t?_method=put \"%.2f\" ", t);
   sePort.printf(Header);
   sePort.printf("\n");
}
int main() {
   sePort.baud(9600);
   pcPort.baud(9600);
   pcPort.printf("Ready.\n");

  while (1){
       myled = 1;
       float t = ((ain * 3300.0) - 600.0) / 10.0;
       pcPort.printf("t: %.2f\n", t);        
       uploadCloud(t);
       myled = 0;
       wait(30);
   }
}

補足
  • 使用するクラウドサービスxively.comについては、下記に解説記事があるので参照されたい。




  • 最終更新:2014-11-27 17:27:41

このWIKIを編集するにはパスワード入力が必要です

認証パスワード