Nucleo based high altitude balloon computer
Dependencies: SDFileSystem Venus838 mbed MS5611 TinyGPS
Atlas.cpp
- Committer:
- ethanharstad
- Date:
- 2014-06-24
- Revision:
- 1:678ba5aa45fc
- Child:
- 2:244d3912b449
File content as of revision 1:678ba5aa45fc:
#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());
}
}
}