![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Custom Game Controllers assembled in lab sessions and mounted with Nokia N5110 LCD display and a FRDM-K64F mbed plus various buttons, a joystick, potentiometer and piezo. Designed a game called 'Fruit Basket' to be played on the game controller where the player controls a basket and moves it catch objects that fall from random points along the top of the display to collect score.
Dependencies: Basket Catch_Model Fruit Gamepad N5110 Objects mbed
Diff: Project_Submission.cpp
- Revision:
- 11:a6a88a51dd57
- Parent:
- 10:92a658c3c5a4
- Child:
- 12:d87c9ae89472
diff -r 92a658c3c5a4 -r a6a88a51dd57 Project_Submission.cpp --- a/Project_Submission.cpp Sat Apr 15 15:07:34 2017 +0000 +++ b/Project_Submission.cpp Tue Apr 18 14:29:05 2017 +0000 @@ -12,11 +12,13 @@ N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad pad; Catch_Model catchm; +Objects objects; //FUNCTION PROTOTYPES// void init(); void render(); void welcome(); +void speed_select(); //MAIN// int main() @@ -27,6 +29,7 @@ init(); welcome(); + //speed_select(); render(); wait(1.0f/fps); int lives; @@ -42,7 +45,8 @@ lives = catchm.get_lives(); render(); wait(1.0f/fps); - } while(lives > 0); + + } while(lives > 0); } } @@ -66,7 +70,8 @@ lcd.refresh(); } -void welcome() { +void welcome() +{ lcd.printString(" Press Start ",0,2); lcd.refresh(); @@ -78,4 +83,26 @@ wait(0.1); } pad.tone(500, 0.5); +} + +void speed_select() +{ + lcd.clear(); + lcd.refresh(); + + while (pad.check_event(Gamepad::START_PRESSED) == false) { + + objects.speed_select(pad); + + char buffer[14]; + float speed = objects.get_speed(); + int print_speed = sprintf(buffer, "%10.2f", speed); + + if (speed > 1) { + lcd.printString("INSANE",0,0); + } else if (speed != 0) { + lcd.printString(buffer,0,0); + } + lcd.refresh(); + } } \ No newline at end of file