![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Embedded software Assessment 2
Dependencies: MCP23017 SDFileSystem USBDevice WattBob_TextLCD mbed
Diff: Function.h
- Revision:
- 8:16a77a68e4b4
- Parent:
- 7:d9f86e1b8185
- Child:
- 9:539c51b7db52
diff -r d9f86e1b8185 -r 16a77a68e4b4 Function.h --- a/Function.h Wed Feb 19 17:33:00 2014 +0000 +++ b/Function.h Thu Feb 20 00:29:09 2014 +0000 @@ -1,20 +1,20 @@ #include "MCP23017.h" #include "WattBob_TextLCD.h" #include "mbed.h" -//#include "SDFileSystem.h" +#include "SDFileSystem.h" MCP23017 Port(p9,p10,0x40) ; // 16-bit parallel I/O object WattBob_TextLCD LCD(&Port); // Varaible to 2*16 chacater LCD object BusOut BinLed(LED4, LED3, LED2, LED1); -DigitalIn FrequencyIn(p5); -DigitalIn Switch1(p7); -DigitalIn Switch2(p8); +DigitalIn FrequencyIn(p15); +DigitalIn Switch1(p17); +DigitalIn Switch2(p18); AnalogIn Analogue_in_1(p19); AnalogIn Analogue_in_2(p20); -//SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board +SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board uint8_t Analug1_valu[5]={0,0,0,0,0}; uint8_t Analug2_valu[5]={0,0,0,0,0}; @@ -48,6 +48,8 @@ Port.write_bit(1,BL_BIT); Write_LCD("Muaiyd",0,4,1); Write_LCD("Heriot-Watt Uni.",1,0,0); + //wait(1); + //LCD.cls(); } @@ -180,5 +182,16 @@ } void LogFile(){ - + 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"); } \ No newline at end of file