test menu
Dependencies: Menu RPG SMARTGPU TextLCD Ton mbed
Fork of lcd_menu by
notes.h
- Committer:
- jjcimon
- Date:
- 2015-05-13
- Revision:
- 4:05868e0f5d7e
- Parent:
- 2:202735df93cd
File content as of revision 4:05868e0f5d7e:
//SDFileSystem sd(p5, p6, p7, p8, "sd"); /* struct dirent *p; DIR *d = opendir("/sd/mydir"); char line[80]; string filename; while((p = readdir(d)) != NULL){ menu.push_back(p->d_name); } */ //lcd.printf("%s\n", test.getText()); /*lcd.printf(">%s\n", menu[cursor].c_str()); lcd.printf(" %s", menu[cursor+1].c_str()); while(1){ if((dirt = rpg1.dir())!=0){ //Get Dir wait(0.15); cursor = cursor + dirt; //Ad Dir to count if(cursor < 0) cursor = 0; else if(cursor > 8) cursor = 8; lcd.cls(); lcd.printf(">%s\n", menu[cursor].c_str()); lcd.printf(" %s", menu[cursor+1].c_str()); } if (rpg1.pb()){ wait(0.25); lcd.cls(); filename = "/sd/mydir/"+menu[cursor]; //lcd.printf("%s\n", filename); FILE *fp = fopen(filename.c_str(), "r"); if(fp == NULL) { error("Could not open file for reading\n"); } fgets(line, 80, fp); lcd.printf("%s\n", line); fclose(fp); } } */