This program is for Cansat made with BreadBoard which have pressure sensor LPS331. This program is based on http://mbed.org/users/nyamfg/code/LPS331_HelloWorld/
Diff: main.cpp
- Revision:
- 8:505d06bba7b1
- Parent:
- 7:8407141d1f70
- Child:
- 9:3285ed711197
--- a/main.cpp Mon Sep 08 01:54:25 2014 +0000 +++ b/main.cpp Mon Sep 08 06:06:04 2014 +0000 @@ -11,6 +11,8 @@ DigitalIn JP(p6); LocalFileSystem local("local"); +Serial telem(p13,p14); + Timer t; LPS331_I2C lps331(p9, p10, LPS331_I2C_SA0_HIGH); // 気圧センサ @@ -27,6 +29,8 @@ fprintf(fp,"BBsat start. **********\r\n"); // fprintf()は、ファイルに文字を出力 fclose(fp); + telem.printf("BBsat start. **********\r\n"); // テレメトリ用出力 + t.start(); while(1) { @@ -35,11 +39,8 @@ float temp=lps331.getTemperature(); // 気温 float height; // 高度 -//★デバッグ用 - pres = 900; - + // 高度算出 height = ( (powf((P0/pres),1/5.257f)-1)*(TEMP+273.15) ) / 0.0065f; - printf("height = %5.1f\r\n", height); if(JP==0) { // JPが0(GND)だったら、 break; //whileのループを終了 @@ -51,6 +52,7 @@ fprintf(fp, "%10d,%6.2f,%4.1f,%5.1f\r\n", ms, pres, temp, height); // 時刻,気圧,気温を出力 fclose(fp); + telem.printf("%10d,%6.2f,%4.1f,%5.1f\r\n", ms, pres, temp, height); // 時刻,気圧,気温を出力 wait(0.05); // LED点滅 myled = 1; wait(0.05);