Not finished. This is my first attemp to make an autonomous vehicle for the Sparkfun Autonomous Competition (https://avc.sparkfun.com/) of June 2015.
Dependencies: FXOS8700CQ SDFileSystem mbed
Fork of AVC_Robot_Controled_Navigation by
- For my autonomous robot I will use a GPS, magnometer, accelerometer, and encoders.
- I control my robot with a remote control to save the GPS points (detect turns) using a xBee radio and save them to a file in a SD card.
Diff: my_libraries/sd_card.cpp
- Revision:
- 2:94059cb643be
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/my_libraries/sd_card.cpp Thu Oct 16 17:30:52 2014 +0000 @@ -0,0 +1,32 @@ +// ----- Libraries ------------------------------------------------------------------ +#include "mbed.h" +#include "sd_card.h" + +// ----- Constants ------------------------------------------------------------------ + + +// ----- I/O Pins ------------------------------------------------------------------- +SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS + +// ----- Others --------------------------------------------------------------------- +FILE *fp; + +// ----- Variables ------------------------------------------------------------------ +int lat_points[10], lon_points[10]; +int points_gps; + + +// ----- Functions ------------------------------------------------------------------ +void savefile_sd(){ + FILE *fp = fopen("/sd/gps_points.txt", "w"); + if (fp == 0){ + //printf("Could not open file\n"); + }else{ + for (int i = 0; i < points_gps; i++){ + fprintf(fp, "%f\t%f", lat_points[i], lon_points[i]); + fprintf(fp, "\r\n"); + } + } + fclose(fp); +} +