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:
- 5:f2944e456618
- Parent:
- 4:4c01d79dd741
--- a/main.cpp Thu Jul 24 01:10:38 2014 +0000 +++ b/main.cpp Thu Jul 24 02:15:11 2014 +0000 @@ -10,14 +10,22 @@ LPS331_I2C lps331(p9, p10, LPS331_I2C_SA0_HIGH); // 気圧センサ int main() { + char id; + printf("start BBsat\r\n"); JP.mode(PullUp); + id = lps331.whoami(); + printf("id = %x\r\n", id); + lps331.setResolution(LPS331_I2C_PRESSURE_AVG_512, LPS331_I2C_TEMP_AVG_128); lps331.setDataRate(LPS331_I2C_DATARATE_7HZ); // 7Hz(1秒間に7回更新) lps331.setActive(true); // 動作開始 FILE *fp = fopen("/local/data.txt", "a"); // 「追記」でファイルを開く + if(fp==NULL) { + printf("fopen error.\r\n"); + } fprintf(fp,"BBsat start. **********\r\n"); // fprintf()は、ファイルに文字を出力 fclose(fp);