Digital dog
/
Nucleo_LCD4884
LCD4884
Revision 0:7bfcf6451577, committed 2017-12-08
- Comitter:
- BIN11
- Date:
- Fri Dec 08 04:48:10 2017 +0000
- Commit message:
- menu_dogLCD
Changed in this revision
diff -r 000000000000 -r 7bfcf6451577 LCD4884.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD4884.lib Fri Dec 08 04:48:10 2017 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Digital-dog/code/LCD4884/#57116095aa73
diff -r 000000000000 -r 7bfcf6451577 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 08 04:48:10 2017 +0000 @@ -0,0 +1,66 @@ +#include "mbed.h" +#include "LCD4884.h" + +LCD4884 object; +AnalogIn analog(A0); +char b[10]; +int state_menu=0; +int data=0; + +void choose_menu(int dog) +{ + + switch(dog) { + case 1: + float a=analog.read(); + if( a>0.3 && a<0.5){ + //object.LCD_write_string(3,0,b, MENU_NORMAL); + object.LCD_clear(); + object.LCD_write_string(0,1,"MENU", MENU_NORMAL); + object.LCD_write_string(0,2,"1.SET_TIME", MENU_HIGHLIGHT); + object.LCD_write_string(0,3,"2.FOOD_DATA", MENU_NORMAL); + object.LCD_write_string(0,4,"3.FOOD_TOTAL", MENU_NORMAL); + data++; + } + case 2: + if( a>0.3 && a<0.5){ + //object.LCD_write_string(3,0,b, MENU_NORMAL); + object.LCD_write_string(0,1,"MENU", MENU_NORMAL); + object.LCD_write_string(0,2,"1.SET_TIME", MENU_NORMAL); + object.LCD_write_string(0,3,"2.FOOD_DATA", MENU_HIGHLIGHT); + object.LCD_write_string(0,4,"3.FOOD_TOTAL", MENU_NORMAL); + data++; + } + case 3: + if( a>0.3 && a<0.5){ + //object.LCD_write_string(3,0,d, MENU_NORMAL); + object.LCD_write_string(0,1,"MENU", MENU_NORMAL); + object.LCD_write_string(0,2,"1.SET_TIME", MENU_NORMAL); + object.LCD_write_string(0,3,"2.FOOD_DATA", MENU_NORMAL); + object.LCD_write_string(0,4,"3.FOOD_TOTAL", MENU_HIGHLIGHT); + data=1; + } + } +} +int main() +{ + object.LCD_init(); + while(1) { + if(state_menu == 0){ + float a=analog.read(); + sprintf(b,"%.01f",a); + object.LCD_write_string(3,0,b, MENU_NORMAL); + object.LCD_write_string(0,1,"MENU", MENU_NORMAL); + object.LCD_write_string(0,2,"1.SET_TIME", MENU_NORMAL); + object.LCD_write_string(0,3,"2.FOOD_DATA", MENU_NORMAL); + object.LCD_write_string(0,4,"3.FOOD_TOTAL", MENU_NORMAL); + if( a>0.3 && a<0.5){ + data=1; + choose_menu(data); + } + + + } + wait(0.1); + } +}
diff -r 000000000000 -r 7bfcf6451577 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 08 04:48:10 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file