Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 2:6792f99c3c0d
- Parent:
- 1:5aba5e5a748b
- Child:
- 3:36f9e3a75905
diff -r 5aba5e5a748b -r 6792f99c3c0d main.cpp
--- a/main.cpp Wed Mar 04 12:04:43 2020 +0000
+++ b/main.cpp Wed May 06 08:42:27 2020 +0000
@@ -19,9 +19,47 @@
// objects
Gamepad pad;
N5110 lcd;
+BusIn input(PTC5, PTC9, PTC7);
+
+void welcome();
+
int main()
{
+ lcd.init();
+ welcome(); //display welcome age on start up
+ input.mode(PullUp);
+ while(1) {
+ int state = input; //creates an integer number from button input
+ //printf("state: %d\n", state);
+ //switch state based on button presses
+ switch(state) {
+ case 3:
+ lcd.clear();
+ lcd.printString("Playing the game",0,3);
+ lcd.refresh();
+ break;
+ case 5:
+ lcd.clear();
+ lcd.printString("High Scores",0,3);
+ lcd.refresh();
+ break;
+ case 6:
+ lcd.clear();
+ lcd.printString("How to play",0,3);
+ lcd.refresh();
+ break;
+ }
+ }
+
}
+void welcome() {
+ lcd.printString("SNAKE", 28, 0);
+ lcd.printString("A.Play Game", 0, 1);
+ lcd.printString("B.Highscores", 0, 2);
+ lcd.printString("X.How to Play", 0, 3);
+ lcd.refresh();
+}
+