test menu

Dependencies:   Menu RPG SMARTGPU TextLCD Ton mbed

Fork of lcd_menu by Peihsun Yeh

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers notes.h Source File

notes.h

00001 //SDFileSystem sd(p5, p6, p7, p8, "sd"); 
00002 
00003 /*
00004 struct dirent *p;
00005     DIR *d = opendir("/sd/mydir");
00006     char line[80];
00007     string filename;
00008     
00009     while((p = readdir(d)) != NULL){
00010         menu.push_back(p->d_name);
00011     }
00012 
00013 */
00014 //lcd.printf("%s\n", test.getText());
00015     
00016     /*lcd.printf(">%s\n", menu[cursor].c_str()); 
00017     lcd.printf(" %s", menu[cursor+1].c_str());
00018     while(1){
00019         if((dirt = rpg1.dir())!=0){ //Get Dir
00020             wait(0.15);
00021             cursor = cursor + dirt; //Ad Dir to count
00022             if(cursor < 0) cursor = 0;
00023             else if(cursor > 8) cursor = 8;
00024             lcd.cls();
00025             lcd.printf(">%s\n", menu[cursor].c_str()); 
00026             lcd.printf(" %s", menu[cursor+1].c_str());
00027         }
00028         
00029         if (rpg1.pb()){
00030             wait(0.25);
00031             lcd.cls();
00032             filename = "/sd/mydir/"+menu[cursor];
00033             //lcd.printf("%s\n", filename);
00034             FILE *fp = fopen(filename.c_str(), "r");
00035             if(fp == NULL) {
00036                 error("Could not open file for reading\n");
00037             }
00038             fgets(line, 80, fp);
00039             lcd.printf("%s\n", line);
00040             fclose(fp);
00041         }
00042     }
00043     */