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: N5110 PowerControl mbed
Diff: main.cpp
- Revision:
- 18:d0900678656a
- Parent:
- 17:9a8a6516d63d
- Child:
- 19:e2659a0b91fa
--- a/main.cpp Tue Apr 28 13:55:09 2015 +0000 +++ b/main.cpp Tue Apr 28 14:18:07 2015 +0000 @@ -5,13 +5,7 @@ */ #include "main.h" -#include "mbed.h" -#include "N5110.h" -#define DIRECTION_TOLERANCE 0.2// Tolerance of Joystick -#include "tone.h" -#define PI 3.14159265359 -#include "PowerControl/PowerControl.h" -#include "PowerControl/EthernetPowerControl.h" + BusOut myleds(p24,p23,p22); //External LEDS volatile bool win= false; volatile bool lose= false; @@ -23,22 +17,22 @@ AnalogIn yPot(p16);// Joystick y-direction InterruptIn button(p18);//Pause button Ticker pollJoystick; // timer to regularly read the joystick -int i=3; // Pacman's starting position -int j = 3; -int buttonflag=0; // flag for pause button +//int i=3; // Pacman's starting position +//int j = 3; +//int buttonflag=0; // flag for pause button int x=67; // Ghost starting position int y = 44; int timerflag=0;// flag for timeout function -int w=30;// winning condition variable +int w=28;// winning condition variable -int coins[30][2] = { // array for location of coins +int coins[28][2] = { // array for location of coins {10,3},{22,3},{35,3},{47,3},{65,3},{80,3}, {41,14}, {3,15},{15,15},{65,15},{80,15}, {7,24},{19,24},{34,24},{47,24},{62,24},{74,24}, - {7,33},{23,33},{41,33},{61,33,{74,33} + {7,33},{23,33},{41,33},{61,33},{74,33}, {7,44},{21,44},{35,44},{47,44},{61,44},{74,44} }; @@ -226,7 +220,7 @@ void drawCoin(void) { - for (int k=0; k<30; k++) { + for (int k=0; k<28; k++) { lcd.drawCircle(coins[k][0], coins[k][1],2,0); } } @@ -235,7 +229,7 @@ void checkCoin() { - for (int c=0; c<30; c++) { + for (int c=0; c<28; c++) { if(i==coins[c][0]&& j==coins[c][1]) { coins[c][0]=90; coins[c][1]=50;