...
Dependencies: C12832_lcd mbed
Fork of app-board-Joystick-with-LCD by
Revision 1:0a9b8bc45ab6, committed 2017-02-22
- Comitter:
- Fleishmachine
- Date:
- Wed Feb 22 11:20:52 2017 +0000
- Parent:
- 0:3cb0e69f1806
- Commit message:
- joy
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3cb0e69f1806 -r 0a9b8bc45ab6 main.cpp --- a/main.cpp Tue Oct 08 11:13:01 2013 +0000 +++ b/main.cpp Wed Feb 22 11:20:52 2017 +0000 @@ -6,36 +6,42 @@ BusIn Up(p15); BusIn Down(p12); -BusIn Left(p13); -BusIn Right(p16); -BusOut Reset(p14); + // Custom Function +float MIN = 20; void initialize(); + // Main int main() + { initialize(); while(1) { - lcd.locate(0,15); // Set Location print a text + lcd.locate(0,0); // Set Location print a text // Operations by Joystic - if (Up) - lcd.printf("UP"); + if (Up) + { + lcd.printf("+"); + MIN++; + } + if (Down) - lcd.printf("Down"); - if (Left) - lcd.printf("Left"); - if (Right) - lcd.printf("Right"); - if (Reset) - initialize(); + { + lcd.printf("-"); + MIN--; + } + + lcd.locate(0,12); + lcd.printf("Minimum value = %0.0f",MIN); + + wait(0.5); } } void initialize() { lcd.cls(); lcd.locate(0,0); - lcd.printf("Joystic and LCD Controller!"); } \ No newline at end of file