A project similar to http://mbed.org/users/lhiggs/code/UM6_IMU_AHRS_2012/, where I'm trying to log data from a UM6 (CH Robotics orientation sensor) and a GPS transceiver to an sd card. I've adapted LHiggs code to include ModGPS. For sum reason a soon as I pick up a gps signal the UM6 data freezes i.e. the time and gps signals continue to print out but the UM6 signals fixes on a single value.
Dependencies: MODGPS MODSERIAL SDFileSystem mbed
Diff: main.cpp
- Revision:
- 2:4a6e89c2d82a
- Parent:
- 1:9fe40d9ac0f5
- Child:
- 3:b3358ec2f57c
--- a/main.cpp Thu May 23 14:08:06 2013 +0000 +++ b/main.cpp Thu May 23 15:02:07 2013 +0000 @@ -22,17 +22,21 @@ //============= Main Program =========================================// int main() { pc.baud(115200); // baud rate to pc interface - tick.attach(&LogData, 0.001); // attaches LogData function to 'tick' ticker interrupt every 0.5s + FILE *fp = fopen("/local/ticker4.txt", "w"); + + tick.attach(&LogData, 0.01); // attaches LogData function to 'tick' ticker interrupt every 0.5s while(1) { while(enable) { if(flag==1) { // prints counter value every interrupt raises flag myled=1; - pc.printf("%2d \n",counter); + fprintf(fp,"%d \n",counter); + pc.printf("%d \n",counter); flag=0; } // end if(flag=1) loop } // end while(enable) loop + fclose(fp); myled=0; // turns off LED when enable switch off counter=0; // resets counter - } // end while(1) loop + } // end while(1) loop } // end main() loop