Atlas data logger
Dependencies: MPU9150 SDFileSystem mbed
Revision 0:a896760ee53b, committed 2014-06-20
- Comitter:
- ethanharstad
- Date:
- Fri Jun 20 19:59:59 2014 +0000
- Commit message:
- Test code
Changed in this revision
diff -r 000000000000 -r a896760ee53b Atlas.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Atlas.cpp Fri Jun 20 19:59:59 2014 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#include "Atlas.h" +#include "SDFileSystem.h" + +DigitalOut grn(LED_GRN); +DigitalOut ylw(LED_YLW); +Serial pc(USBTX, USBRX); +Serial gps(GPS_TX, GPS_RX); +SDFileSystem sd(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, "sd"); + +void init() { + pc.baud(115200); + gps.baud(115200); + grn = LED_ON; + ylw = LED_ON; + + printf("Attempting to open SD card...\n"); + mkdir("/sd/mydir", 0777); + + printf("Attempting to open file...\n"); + FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); + if(fp == NULL) { + error("Could not open file for write\n"); + ylw = LED_OFF; + } + fprintf(fp, "Hello fun SD Card World!"); + + printf("Closing file...\n"); + fclose(fp); + + pc.printf("Atlas Ready!\n"); +} + +int main() { + init(); + while(true) { + if(gps.readable()) { + pc.putc(gps.getc()); + } + } +} \ No newline at end of file
diff -r 000000000000 -r a896760ee53b Atlas.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Atlas.h Fri Jun 20 19:59:59 2014 +0000 @@ -0,0 +1,15 @@ +#define LED_GRN PC_8 +#define LED_YLW PC_6 +#define LED_ON 0 +#define LED_OFF 1 + +#define GPS_TX PA_11 +#define GPS_RX PA_12 + +#define RFD_TX PA_2 +#define RFD_RX PA_3 + +#define XBEE_TX PA_9 +#define XBEE_RX PA_10 + +#define IMU_INT PC_5 \ No newline at end of file
diff -r 000000000000 -r a896760ee53b MPU9150.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPU9150.lib Fri Jun 20 19:59:59 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/ethanharstad/code/MPU9150/#581fad93a809
diff -r 000000000000 -r a896760ee53b SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Fri Jun 20 19:59:59 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/mbed/code/SDFileSystem/#7b35d1709458
diff -r 000000000000 -r a896760ee53b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 20 19:59:59 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721 \ No newline at end of file