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: Eng.cpp
- Revision:
- 11:9661467412cf
- Parent:
- 10:6c574b8524df
- Child:
- 12:e3620d33629c
--- a/Eng.cpp Mon May 18 13:12:35 2020 +0000 +++ b/Eng.cpp Mon May 18 13:32:55 2020 +0000 @@ -93,6 +93,8 @@ (aim_pos.x <= h1_pos.x + 11) //right ) { heston.hit(pad); + print_score(lcd); + lcd.refresh(); } else if ( (pupon == 1) && @@ -108,7 +110,7 @@ } else { heston.miss(pad); - print_score(lcd); + print_strike(lcd); lcd.refresh(); } wait(0.4); @@ -136,10 +138,21 @@ } } +void Eng::print_strike(N5110 &lcd) +{ + // get scores from paddles + int g_score = heston.checkstrike(); + + // print to LCD i + char buffer1[14]; + sprintf(buffer1,"%2d",g_score); + lcd.printString(buffer1,1,1); // font is 8 wide, so leave 4 pixel gape from middle assuming two digits +} + void Eng::print_score(N5110 &lcd) { // get scores from paddles - int g_score = heston.checkstrike(); + int g_score = heston.checkscore(); // print to LCD i char buffer1[14];