ECG_ADS1198
Dependencies: ADSlib mbed SDFileSystem
This was created for an internship project at IIT hyderabad.
Diff: main.cpp
- Revision:
- 3:86eef673aec5
- Parent:
- 2:86845af4bcac
- Child:
- 4:dee470044b03
--- a/main.cpp Sun Apr 05 20:34:03 2015 +0000 +++ b/main.cpp Tue Apr 07 18:49:23 2015 +0000 @@ -1,19 +1,22 @@ #include "mbed.h" #include "ADSlib.h" +#include "SDFileSystem/SDFileSystem.h" -/***********************PROTOTYPING**********************************/ +/***********************PROTOTYPING AND SETTINGS*********************/ DigitalOut CLKSEL(p8); -DigitalOut ADS1CS(p11); -DigitalOut ADS2CS(p12); -DigitalOut MULT_ADS(p13); +DigitalOut ADS1CS(p16); +DigitalOut ADS2CS(p17); +DigitalOut MULT_ADS(p18); DigitalOut PWDN(p10); DigitalOut RESETpin(p9); -DigitalOut STARTpin(p14); +DigitalOut STARTpin(p19); DigitalIn DRDY(p15); SPI spi(p5,p6,p7); -/********************************************************************/ +SDFileSystem sd(p11,p12,p13,p14,"sd"); signed char Input_Data_Stream[19]; int16_t Input_modified[12]; +LocalFileSystem local("local"); +/********************************************************************/ int main() // main call { @@ -83,6 +86,32 @@ Input_modified[11]=((2*Input_modified[7])-Input_modified[6])/2; spi.write(SDATAC); + /***********************FILE IO PROCEDURE ON LOCAL STORAGE******************/ + FILE* file = fopen("local/logfile.txt","w"); + for (int k =0; k<12; k++) { + fputc(Input_modified[k],file); + } + //dont forget to fclose(file); + /***************************************************************************/ + + +///////////////////////////OR/////////////////////////////////////////////////////////////////////// + + + /****************************SD I/O OPERATIONS *****************************/ + mkdir("sd/logfiledir",0777); + FILE* file1 = fopen("sd/logfiledir/logfile.txt","w"); + for (int k =0; k<12; k++) { + fputc(Input_modified[k],file1); + } + //dont forget to fclose(file1); + /***************************************************************************/ + + + + + +