First release.

Dependencies:   FXOS8700CQ SDFileSystem mbed

Final program

  • Controling a robot by Bluetooth, it is capable of making 90° turns and move pre-defined distances.

Code by:

  • Mayumi Hori
  • Sarahí Morán
  • Gerardo Carmona

my_libraries/sd_card.cpp

Committer:
gerardo_carmona
Date:
2014-11-07
Revision:
5:b384cf06de76
Parent:
2:94059cb643be

File content as of revision 5:b384cf06de76:

// ----- 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);
}