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:
- henririgby98
- Date:
- 2019-05-04
- Revision:
- 2:794ed187ffcd
- Parent:
- 1:c9d346de3a66
- Child:
- 4:d744920089ea
File content as of revision 2:794ed187ffcd:
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
// y x button
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
int sprite[8][11] = {
{ 0,0,1,0,0,0,0,0,1,0,0 },
{ 0,0,0,1,0,0,0,1,0,0,0 },
{ 0,0,1,1,1,1,1,1,1,0,0 },
{ 0,1,1,0,1,1,1,0,1,1,0 },
{ 1,1,1,1,1,1,1,1,1,1,1 },
{ 1,0,1,1,1,1,1,1,1,0,1 },
{ 1,0,1,0,0,0,0,0,1,0,1 },
{ 0,0,0,1,1,0,1,1,0,0,0 },
};
int main() {
lcd.init();
pad.init();
lcd.setContrast(0.6);
float SUM_x = WIDTH/2-6;
float SUM_y = HEIGHT/2-4;
while(1) {
lcd.normalMode(); // normal colour mode
lcd.setBrightness(0.9); // put LED backlight on 50%
lcd.clear();
pad.get_mapped_coord();
Vector2D mapped_coord = pad.get_mapped_coord();
SUM_x = SUM_x + (mapped_coord.x*7);
SUM_y = SUM_y - (mapped_coord.y*7);
wait(0.0001);
lcd.drawSprite(SUM_x,SUM_y,8,11,(int *)sprite);
lcd.refresh();
}
}