parser sample for udenokai
Dependencies: TextLCD csv_parser mbed SDFileSystem
Diff: main.cpp
- Revision:
- 0:913c42fa21db
diff -r 000000000000 -r 913c42fa21db main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 10 18:58:46 2011 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "csv_parser.h" +#include "TextLCD.h" +#include "SDFileSystem.h" +#include <map> +#include <iostream> + +SDFileSystem sd(p5, p6, p7, p8, "sd"); +TextLCD lcd(p24, p26, p27, p28, p29, p30); + +using namespace std; + +int main() +{ + map<string,string> names; + + csv_parser csv; + csv.init("/sd/mydir/koi.csv"); + + while(csv.has_more_rows()){ + csv_row row = csv.get_row(); + names.insert( make_pair( row[0] , row[1] ) ); + } + + for(;;){ + string str; + cin >> str; + if( str == "exit" ) break; + + lcd.cls(); + lcd.printf( names[str].c_str() ); + } +} \ No newline at end of file