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
main.cpp
- Committer:
- sdlashmar
- Date:
- 2020-05-06
- Revision:
- 2:6792f99c3c0d
- Parent:
- 1:5aba5e5a748b
- Child:
- 3:36f9e3a75905
File content as of revision 2:6792f99c3c0d:
/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
2019/20
Name:Samuel Lashmar
Username:el17sdl
Student ID Number:201170334
Date:04/03/20
*/
// includes
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
// 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();
}