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:
- 6:3e50f2cf4366
- Parent:
- 5:915bcac4e9b9
- Child:
- 7:a1a6bff238c1
--- a/main.cpp Tue Apr 16 10:17:21 2019 +0000
+++ b/main.cpp Thu Apr 18 09:31:52 2019 +0000
@@ -16,20 +16,20 @@
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
-Gamepad pad;
+Gamepad pad1;
Ball ball;
Bat bat;
void init();
-void welcome();
+//void welcome();
void draw();
void ball_test();
int main(){
int fps=8;
init();
- //welcome();
+ // welcome();
draw();
/*
while (1){
@@ -39,9 +39,10 @@
*/
float f;
while(1){
- f= pad.get_mag();
+ f= pad1.get_mag();
printf("MAG %f \n",f);
- ball.start(lcd);
+ int lol=bat.get_hitBall();
+ ball.start(lcd,lol);
draw();
wait(1.0f/fps);
}
@@ -51,7 +52,7 @@
}
void init(){
lcd.init();
- pad.init();
+ pad1.init();
bat.init(4,5);
ball.init(2,3);
//field.init();
@@ -62,18 +63,16 @@
}
void welcome() {
-
lcd.printString(" CRICKET GAME ",0,1);
lcd.printString(" SHAHID SAJID",0,2);
lcd.printString(" el17szs ",0,3);
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 ( pad1.check_event(Gamepad::START_PRESSED) == false) {
+ pad1.leds_on();
wait(0.1);
- pad.leds_off();
+ pad1.leds_off();
wait(0.1);
}