Pike Bots for everyone! Uses a MAX32630 as the core. Incorporates Impedance control and SD card libaries for writing data. Reading from current sensor is not perfect due to limited ADC compared to datasheet, to fix in a future version.
Dependencies: BMI160 QEI_pmw SDFileSystem USBDevice kalman max32630fthr mbed
Fork of Pike_the_Flipper_Main_Branch by
Diff: main.cpp
- Revision:
- 0:73a369b7b5b4
- Child:
- 1:59124c69d0c3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 02 06:13:14 2017 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#include "SDFileSystem.h" + +SDFileSystem sd(P0_5, P0_6, P0_4, P0_7, "sd"); // the pinout on the mbed Cool Components workshop board + +FILE * fp2; +char Buffer[512]; +char * pEnd; +float Temperature, Humidity; + +int main() { + + ////// Writing to SD card + printf("Hello World!\n"); + + mkdir("/sd/mydir", 0777); + + FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); + if(fp == NULL) { + error("Could not open file for write\n"); + } + fprintf(fp, "Hello fun SD Card World!\n"); + fprintf(fp, "Dan says hello\n"); + fprintf(fp, "Ken says hello\n"); + fprintf(fp, "Grace says hello\n"); + fclose(fp); + + printf("Goodbye World!\n"); + + ///// Reading from SD card + + fp2 = fopen("/sd/mydir/sdtest.txt", "r"); + if(fp2 == NULL) { error("Could not open file for reading\r\n"); } + + while(fgets (Buffer, 512, fp2) != NULL){ + Buffer[strlen(Buffer)-1] = 0; + printf("String = \"%s\" \r\n", Buffer); + } + fclose(fp2); + +}