2013
Dependencies: BMP085_2 SDFileSystem mbed
Fork of cansat new by
Diff: main.cpp
- Revision:
- 3:37b076ff27a9
- Parent:
- 2:e093c70066d0
- Child:
- 4:5872b6ac17e5
diff -r e093c70066d0 -r 37b076ff27a9 main.cpp --- a/main.cpp Sun Jul 28 07:14:39 2013 +0000 +++ b/main.cpp Sun Jul 28 07:29:25 2013 +0000 @@ -5,6 +5,7 @@ Serial xbee(p13,p14); // tx, rx /*Timeout dater;*/ LocalFileSystem local("local"); +Timer timer; AnalogIn temp_in(p20); AnalogIn acc_x(p17); @@ -23,8 +24,11 @@ time_t epoch = 0; fprintf(fp, "E %d \r", epoch); + timer.start(); + while(1){ - epoch = time(NULL); + //epoch = time(NULL); + float seconds = timer.read(); temp = temp_in; vo = v_out/10*33; ax = acc_x/10; @@ -34,7 +38,7 @@ r_temp = temp_in * 3.3 * 100 ; - fprintf(fp, "E %d ", epoch); + 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); @@ -44,7 +48,7 @@ fprintf(fp,"\n"); if (count % 100 == 0) { - xbee.printf("E %d ", epoch); + 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);