Hi, I would like to incorporate an sdcard to the project and record the number of coins, only when pressing a button (e.g RB7) , but first I want to make a seperate test program using Pic18F4550. As I understood the connection should be simple enough but just to make sure I attached an image of my connections(Please correct me if it's wrong). I found a source code but it's in C.
Code:
// example writing to SD card, sford
#include "mbed.h"
#include "SDFileSystem.h"
SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
int main() {
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!");
fclose(fp);
printf("Goodbye World!\n");
}
The code creates a folder and writes "Hello fun SD Card World" to file name "sdtest.txt".
Hope anyone can help...
thanks in advance,
tacbanon
Bookmarks