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:
- 20:9d21599fe350
- Parent:
- 18:a260ce8db9e7
- Child:
- 22:69d7fe739872
- Child:
- 24:23fd6b451db7
--- a/main.cpp Sat Apr 27 18:16:59 2019 +0000
+++ b/main.cpp Tue Apr 30 10:27:23 2019 +0000
@@ -15,50 +15,35 @@
#include "Bat.h"
#include "Cricket.h"
-
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
-Gamepad pad;
+Gamepad mainpad;
Cricket cricket;
void init();
-//void welcome();
+void welcome();
void draw();
void ball_test();
int main(){
- int fps=10;
+ int fps=14;
init();
- // welcome();
- draw();
- //float f;
- //int status=0;
+ //welcome();
+ //draw();
+
while(1){
- //Direction dir=pad.get_direction();
- cricket.game(lcd,pad);
+
+ cricket.game(lcd,mainpad);
draw();
wait(1.0f/fps);
}
- /*
- while(1){
- ball.reset();
- field.set_field(lcd);
- draw();
- while (status!=1){
- f= pad1.get_mag();
- int lol=bat.get_hitBall();
- ball.start(lcd,lol,pad.get_direction());
- draw();
- wait(1.0f/fps);
- }
- }
- */
+
}
void init(){
lcd.init();
- pad.init();
+ mainpad.init();
//ball1.init(2,4);
cricket.init();
//bat1.init();
@@ -75,12 +60,18 @@
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();
+ while ( mainpad.check_event(Gamepad::START_PRESSED) == false) {
+ printf("Waiting");
+ mainpad.leds_on();
wait(0.1);
- pad.leds_off();
+ mainpad.leds_off();
wait(0.1);
}
+ printf("Out of loop");
+ lcd.clear();
+ lcd.printString(" CRICKET GAME ",0,1);
+ lcd.refresh();
+ wait(10.0);
}
void draw(){
@@ -90,12 +81,3 @@
//bat1.draw(lcd);
lcd.refresh();
}
-/*void ball_test(){
- Vector2D ball_pos = ball.get_pos();
- Vector2D ball_velocity = ball.get_velocity();
- ball.update();
- ball.set_velocity(ball_velocity);
- ball.set_pos(ball_pos);
- ball.update();
-}
-*/
\ No newline at end of file