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:
- RickYu
- Date:
- 2018-04-12
- Revision:
- 2:421fb0670c5c
- Parent:
- 0:4d3c9411e8f2
- Child:
- 3:1a134243e2f0
File content as of revision 2:421fb0670c5c:
#include "mbed.h" #include "stdio.h" #include "stdlib.h" #include "Gamepad.h" #include "N5110.h" #include "rect.h" #include "engine.h" DigitalOut gpo(D0); DigitalOut led(LED_RED); N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad pad; engine rect; void init(); void welcome(); void render(); int main() { int fps = 10; init(); welcome(); //lcd.clear(); //lcd.refresh(); render(); wait(1.0f/fps); while(1){ rect.read_input(pad); rect.update(pad); render(); wait(1.0f/fps); } } void init() { // need to initialise LCD and Gamepad lcd.init(); pad.init(); } void welcome() { lcd.printString(" TXZ ",0,1); lcd.printString(" Press Start ",0,4); lcd.refresh(); // wait flashing LEDs until start button is pressed while ( pad.check_event(Gamepad::START_PRESSED) == false) { pad.leds_on(); wait(0.1); pad.leds_off(); wait(0.1); } } void render() { // clear screen, re-draw and refresh lcd.clear(); rect.draw(lcd); lcd.refresh(); }