Nucleo based high altitude balloon computer
Dependencies: SDFileSystem Venus838 mbed MS5611 TinyGPS
Diff: Atlas.cpp
- Revision:
- 6:f91db4a7acf1
- Parent:
- 5:1facb0e83e62
- Child:
- 7:308ab9062b76
--- a/Atlas.cpp Wed Jun 25 15:02:14 2014 +0000 +++ b/Atlas.cpp Thu Jun 26 14:43:31 2014 +0000 @@ -3,6 +3,7 @@ #include "SDFileSystem.h" #include "Venus838.h" #include "TinyGPS.h" +//#include "nmea_parser.h" #include "MS5611I2C.h" DigitalOut grn(LED_GRN); @@ -19,29 +20,29 @@ pc.baud(115200); grn = LED_OFF; ylw = LED_OFF; - - venus.setUpdateRate(10); + printf("Configuring Venus GPS...\r\n"); + //venus.setUpdateRate(1); venus.setNavigationMode(4); venus.setNmeaMessages(true, false, false, false, true, false); - printf("Attempting to open SD card...\n"); + printf("Attempting to open SD card...\r\n"); mkdir("/sd/debug", 0777); - printf("Attempting to open file...\n"); + printf("Attempting to open file...\r\n"); FILE *fp = fopen("/sd/debug/debug.txt", "w"); if(fp == NULL) { - error("Could not open file for write\n"); + error("Could not open file for write\r\n"); ylw = LED_ON; } fprintf(fp, "Hooray, we can write to the SD Card. Go get a cookie."); - printf("Closing file...\n"); + printf("Closing file...\r\n"); fclose(fp); pres.printCoefficients(); tick.start(); - pc.printf("Atlas Ready!\n"); + pc.printf("Atlas Ready!\r\n"); } int main() { @@ -55,7 +56,7 @@ fprintf(fp, "Atlas Logger\r\n"); fprintf(fp, "Date Time Lon Lat Alt Pressure Temp Battery\r\n"); fprintf(fp, "------------------------------------------------------------------\r\n"); - //fclose(fp); + fclose(fp); while(true) { if(venus.readable()) { char c = venus.getc(); @@ -73,14 +74,16 @@ temperature = pres.getTemperature(); battery = (batt.read()*3.3f) * 4.0f; wait_ms(1); - pc.printf("%u, %u, %f, %f, %f, %f, %f, %f\n", + pc.printf("%u, %u, %f, %f, %f, %f, %f, %f\r\n", date, time, longitude, latitude, altitude, pressure, temperature, battery ); - fprintf(fp, "%u, %u, %f, %f, %f, %f, %f %f\n", + FILE *fp = fopen("/sd/atlas.txt", "a"); + fprintf(fp, "%u, %u, %f, %f, %f, %f, %f %f\r\n", date, time, longitude, latitude, altitude, pressure, temperature, battery ); + fclose(fp); writeCount++; if(writeCount > 100) { writeCount = 0;