BMP085を入れました
Dependencies: BMP085_2 SDFileSystem mbed
main.cpp
- Committer:
- yattu0914
- Date:
- 2013-07-28
- Revision:
- 3:37b076ff27a9
- Parent:
- 2:e093c70066d0
- Child:
- 4:5872b6ac17e5
File content as of revision 3:37b076ff27a9:
#include "mbed.h" //#include "SDFileSystem.h" //SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board Serial xbee(p13,p14); // tx, rx /*Timeout dater;*/ LocalFileSystem local("local"); Timer timer; AnalogIn temp_in(p20); AnalogIn acc_x(p17); AnalogIn acc_y(p18); AnalogIn acc_z(p19); AnalogIn v_out(p16); AnalogIn light_in(p15); int main() { float r_temp, temp; float vo,ax,ay,az, light; FILE* fp = fopen("/local/CanSat.txt", "a"); unsigned count = 0; time_t epoch = 0; fprintf(fp, "E %d \r", epoch); timer.start(); while(1){ //epoch = time(NULL); float seconds = timer.read(); temp = temp_in; vo = v_out/10*33; ax = acc_x/10; ay = acc_y/10; az = acc_z/10; light = light_in/10*33; r_temp = temp_in * 3.3 * 100 ; fprintf(fp, "S %f ", seconds); fprintf(fp, "T %5.2f ",r_temp); fprintf(fp, "H %5.2f ",(vo*8-6)/25); fprintf(fp, "X %5.2f ",(ax*33-1.65)/0.66); fprintf(fp, "Y %5.2f ",(ay*33-1.65)/0.66); fprintf(fp, "Z %5.2f ",(az*33-1.65)/0.66); fprintf(fp, "L %5.2f",light); fprintf(fp,"\n"); if (count % 100 == 0) { xbee.printf("S %f ", seconds); xbee.printf("T %5.2f ",r_temp); xbee.printf("H %5.2f ",((vo*8-6)/25)); xbee.printf("X %5.2f ",(ax*33-1.65)/0.66); xbee.printf("Y %5.2f ",(ay*33-1.65)/0.66); xbee.printf("Z %5.2f ",(az*33-1.65)/0.66); xbee.printf("L %5.2f",light); xbee.printf("\n\r"); }//if ++count; wait(0.01); }//while //fclose(fp); }