![](/media/cache/profiles/83bdd5a91e556ca3b57aafab83ee8ef5.50x50_q85.jpg)
This program is for "LEDCUBE4mbed". You can change the mode for changing the value of "debug".
Dependencies: ConfigFile FatFileSystem SDFileSystem mbed
main.cpp
- Committer:
- ds074704261
- Date:
- 2012-08-09
- Revision:
- 0:bedae49a4612
- Child:
- 1:0991aefbe7be
File content as of revision 0:bedae49a4612:
#include "mbed.h" #include "ConfigFile.h" //#include "SDFileSystem.h" ConfigFile cfg; LocalFileSystem local("local"); /* * ================================================== * Definition of "LINE" * ================================================== * * C1 C2 C3 C4 C5 * -------------------- * L1 L2 L3 L4 L5 * L6 L7 L8 L9 L10 * L11 L12 L13 L14 L15 * L16 L17 L18 L19 L20 * L21 L22 L23 L24 L25 * * ================================================== */ BusOut leds(LED1, LED2, LED3, LED4); DigitalOut C1(p25); //line1 to line5 DigitalOut C2(p24); //line6 to line10 DigitalOut C3(p23); //line11 to line15 DigitalOut C4(p22); //line16 to line20 DigitalOut C5(p21); //line21 to line25 DigitalOut Call[] = {p25, p24, p23, p22, p21}; DigitalOut mclock(p5); //mainclock DigitalOut sclock(p6); //subclock /* ================================================== * Not implemented * ================================================== */ //AnalogIn volume(p20); /* // MicroSD Ssytem #include "SDFileSystem.h" #define SD_MOSI p5 #define SD_MISO p6 #define SD_SCLK p7 #define SD_CS p8 //SDFileSystem sd(p5, p6, p7, p13, "sd"); // mosi, miso, sclk, cs, name SDFileSystem sd(SD_MOSI, SD_MISO, SD_SCLK, SD_CS, "sd"); // mosi, miso, sclk, cs, name (HW modification candidate) */ void resetColumn() { } int main() { //error if (!cfg.read("/local/pattern.cfg")) { printf("Failure to read a configuration file.\n"); while(1){ leds = 15; wait(0.1); leds = 0; wait(0.1); } } //read file printf("reading file...\n"); cfg.read("/local/pattern.cfg"); const int cnt = cfg.getCount(); char buf_key[BUFSIZ]; char buf_value[BUFSIZ]; int n; long sin2; for (int i = 0; i < cnt; i++) { if (cfg.getKeyAndValue(i, buf_key, sizeof(buf_key), buf_value, sizeof(buf_value))) { //printf("No.%3d:'%s'='%s'\n", i, buf_key, buf_value); sin2 = strtol(buf_value, NULL, 2); printf("%d = %d\n", i+1, sin2); } else { printf("No.%3d:Failure to get a configuration.\n", i); } } }