![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Keg sharing system
Dependencies: 4DGL-uLCD-SE TextLCD mbed
Diff: main.cpp
- Revision:
- 4:bcb5be37a0e1
- Parent:
- 3:861e3433e5e1
- Child:
- 5:571cd0eea9be
--- a/main.cpp Fri Dec 09 02:01:55 2016 +0000 +++ b/main.cpp Fri Dec 09 02:08:46 2016 +0000 @@ -18,7 +18,7 @@ Mpr121 keypad ( & i2c , Mpr121::ADD_VSS ) ; // LCD ( tx , rx , reset ) -uLCD_4DGL lcd ( p28 , p27 , p5 ) ; +//uLCD_4DGL lcd ( p28 , p27 , p5 ) ; // flow meter InterruptIn pulse_interrupt ( p11 ) ; @@ -30,17 +30,17 @@ void pulse ( ) { ++ pulse_count ; - lcd.locate ( 4 , 8 ) ; - lcd.printf ( "%f mL" , pulse_milliLiters ( ) ) ; +// lcd.locate ( 4 , 8 ) ; +// lcd.printf ( "%f mL" , pulse_milliLiters ( ) ) ; } void read_pin ( ) { - lcd.filled_rectangle ( 0 , 0 , 128 , 128 , BLACK ) ; - lcd.locate ( 4 , 6 ) ; - lcd.printf ( "Enter PIN" ) ; - lcd.locate ( 4 , 7 ) ; - lcd.printf ( "on keypad" ) ; +// lcd.filled_rectangle ( 0 , 0 , 128 , 128 , BLACK ) ; +// lcd.locate ( 4 , 6 ) ; +// lcd.printf ( "Enter PIN" ) ; +// lcd.locate ( 4 , 7 ) ; +// lcd.printf ( "on keypad" ) ; } enum @@ -63,8 +63,8 @@ case 0x1 : // DELETE - lcd.locate ( pin_col + pin_count , pin_row ) ; - lcd.printf ( " " ) ; +// lcd.locate ( pin_col + pin_count , pin_row ) ; +// lcd.printf ( " " ) ; if ( pin_count != 0 ) { -- pin_count ; @@ -75,8 +75,8 @@ case 0x100 : // DONE com.printf ( "a%020f\n" , pulse_milliLiters ( ) ) ; - lcd.locate ( 0 , 10 ) ; - lcd.printf ( "Done pouring." ) ; +// lcd.locate ( 0 , 10 ) ; +// lcd.printf ( "Done pouring." ) ; pulse_count = 0 ; read_pin ( ) ; return ; @@ -93,8 +93,8 @@ case 0x800 : pin_value = pin_value * 10 + 9 ; break ; // 9 } - lcd.locate ( pin_col + pin_count , pin_row ) ; - lcd.printf ( "*" ) ; +// lcd.locate ( pin_col + pin_count , pin_row ) ; +// lcd.printf ( "*" ) ; if ( pin_count == 3 ) { @@ -105,33 +105,33 @@ char readbuffer [ 2 ] ; com.gets ( readbuffer , 2 ) ; // receive verification - lcd.locate ( 4 , 6 ) ; +// lcd.locate ( 4 , 6 ) ; switch ( readbuffer [ 0 ] ) // parse verification { case '0' : // INVALID - lcd.filled_rectangle ( 0 , 0 , 128 , 128 , RED ) ; - lcd.locate ( 4 , 5 ) ; - lcd.printf ( "INVALID PIN" ) ; +// lcd.filled_rectangle ( 0 , 0 , 128 , 128 , RED ) ; +// lcd.locate ( 4 , 5 ) ; +// lcd.printf ( "INVALID PIN" ) ; led3 = ! led3 ; - wait_ms ( 1024 ) ; +// wait_ms ( 1024 ) ; read_pin ( ) ; break ; case '1' : // VALID - lcd.filled_rectangle ( 0 , 0 , 128 , 128 , GREEN ) ; - lcd.printf ( "Pour beer" ) ; - lcd.locate ( 4 , 8 ) ; +// lcd.filled_rectangle ( 0 , 0 , 128 , 128 , GREEN ) ; +// lcd.printf ( "Pour beer" ) ; +// lcd.locate ( 4 , 8 ) ; led4 = ! led4 ; char buffer [ 6 ] ; com.gets ( buffer , sizeof ( buffer ) ) ; - lcd.locate ( 4 , 10 ) ; - lcd.printf ( "Current owed: $%s" , buffer ) ; +// lcd.locate ( 4 , 10 ) ; +// lcd.printf ( "Current owed: $%s" , buffer ) ; break ; default: // ERROR - lcd.filled_rectangle ( 0 , 0 , 128 , 128 , YELLOW ) ; - lcd.printf ( "TRANSMISSION ERROR" ) ; +// lcd.filled_rectangle ( 0 , 0 , 128 , 128 , YELLOW ) ; +// lcd.printf ( "TRANSMISSION ERROR" ) ; led2 = ! led2 ; exit ( 1 ) ; break ;