![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
LCD4884
main.cpp
- Committer:
- BIN11
- Date:
- 2017-12-08
- Revision:
- 0:7bfcf6451577
File content as of revision 0:7bfcf6451577:
#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); } }