Nucleo based high altitude balloon computer
Dependencies: SDFileSystem Venus838 mbed MS5611 TinyGPS
Diff: Atlas.cpp
- Revision:
- 1:678ba5aa45fc
- Child:
- 2:244d3912b449
diff -r 5c7eeb7672d2 -r 678ba5aa45fc Atlas.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Atlas.cpp Tue Jun 24 05:42:15 2014 +0000 @@ -0,0 +1,45 @@ +#include "mbed.h" +#include "Atlas.h" +#include "SDFileSystem.h" +#include "Venus838.h" + +DigitalOut grn(LED_GRN); +DigitalOut ylw(LED_YLW); +Serial pc(USBTX, USBRX); +Venus838 gps(GPS_TX, GPS_RX); +SDFileSystem sd(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, "sd"); + +void init() { + pc.baud(115200); + grn = LED_ON; + ylw = LED_ON; + + gps.setUpdateRate(10); + gps.setNavigationMode(4); + gps.setNmeaMessages(true, false, false, false, true, false); + + 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