Final Project Submission. Taurai Mbakada EL15TM
Dependencies: Joystick_TM mbed
main.cpp
00001 #include "mbed.h" 00002 #include "N5110.h" 00003 #include "spaceship.h" 00004 #include "Joystick.h" 00005 #include "weapons.h" 00006 #include "Asteroids.h" 00007 #include "SongPlayer.h" 00008 00009 /**Main 00010 00011 @brief Game Implementation 00012 @brief Revision 2.5 00013 00014 @author Taurai Mbakada 00015 @date 02 May 2017 00016 00017 **/ 00018 00019 //Game Objects// 00020 00021 N5110 lcd(PTC10 , PTC9, PTC0, PTC7, PTD2, PTD1, PTC11); 00022 Joystick joystick(PTB10, PTB11, PTC16); 00023 00024 //Prototypes// 00025 Spaceship ship; 00026 bulletType1 bullet; 00027 Asteroids astroid; 00028 Gamepad pad; 00029 00030 00031 /* Original/Reset vectors for astroid positions and velocity */ 00032 static const Vector2D og_pos[8] = {{0,24},{80,24},{42,0},{42,48},{70,48},{72,0},{10,0},{10,48}}; 00033 static const Vector2D og_vel[8] = {{1, 0},{-1, 0},{ 0,1},{ 0,-1},{-1,-1},{-1,1},{1,1} ,{1,-1 }}; 00034 00035 /* Actual/Runtime vectors for astroid positions and velocity */ 00036 static Vector2D astr_pos[8] = {{0,24},{80,24},{42,0},{42,48},{70,48},{72,0},{10,0},{10,48}}; 00037 static Vector2D astr_vel[8] = {{1, 0},{-1, 0},{ 0,1},{ 0,-1},{-1,-1},{-1,1},{1,1} ,{1,-1 }}; 00038 00039 /* Function prototypes */ 00040 static void game_init( void ); //intialise game 00041 static void gameRender( void ); //Render game objects 00042 static void bullet_run( Direction joy_dir ); //Bullet track 00043 static void astroid_run( void ); //Astroid trcks 00044 static void mainMenu(); //Menu Initiliastion 00045 static void lcdControl(void); //Brightness 00046 00047 /* Miscellaneous */ 00048 static void bullet_out_of_bounds( void ); 00049 static void bullet_hits( void ); 00050 static void asteroid_hits( void ); 00051 static void welcome( void ); 00052 static void origins (void); 00053 static void gameOver(Gamepad &pad, N5110 &lcd); 00054 static void printScore(N5110 &lcd); 00055 00056 00057 /****************************************************************************** 00058 * Name: main( void) 00059 * 00060 * Description: Entry point for the game. Including welcome screen, 00061 * game instructions and scores. 00062 * 00063 * Parameters: void 00064 * 00065 * Return: should never return 00066 * 00067 *******************************************************************************/ 00068 int main() 00069 { 00070 int fps = 12; // frames per second 00071 // printf("frames per second set"); 00072 Direction joy_dir; // read the direction of the joysick 00073 00074 /* Initialise peripherals and game components */ 00075 game_init(); 00076 //printf("peripherals set"); 00077 00078 welcome(); //initiate welcome screen 00079 //printf("welcome screen displayed"); 00080 00081 mainMenu(); 00082 00083 origins(); //initiate instrcutions 00084 //printf("instructions shown"); 00085 00086 gameRender(); //render game components 00087 //printf("game rendered"); 00088 wait(1.0f/fps); 00089 00090 lcd.refresh(); 00091 00092 00093 /* Ininfinite loop for executing game commands */ 00094 while (true) { 00095 00096 lcd.inverseMode(); 00097 00098 lcdControl(); 00099 //printf("potentiometer changed") 00100 00101 /* Fetch current joystick direction*/ 00102 joy_dir = joystick.get_direction(); 00103 00104 /* Change orientation of ship based on joystick */ 00105 ship.update_ship_pos( joy_dir ); 00106 00107 /* Check if we need to add/reset bullets*/ 00108 bullet_run(joy_dir); 00109 00110 /* Astroid spawn engine */ 00111 astroid_run(); 00112 00113 /* Update all bullets position */ 00114 for(char i = 0; i < 8; i++) { 00115 bullet.update( i ); 00116 } 00117 00118 /* Check for any bullet-astroid hits*/ 00119 bullet_hits(); 00120 00121 /* Check for any ship-astroid hits */ 00122 asteroid_hits(); 00123 00124 /* Render lcd game components */ 00125 gameRender(); 00126 wait(1.0f/fps); 00127 } 00128 } 00129 00130 /****************************************************************************** 00131 * Name: static gameRender( void) 00132 * 00133 * Description: Game rendering function. Ship is put in place, along 00134 * with the astroids and bullets. 00135 * 00136 * Parameters: void 00137 * 00138 * Return: void 00139 * 00140 *******************************************************************************/ 00141 static void gameRender( void ) 00142 { 00143 lcd.clear(); 00144 00145 ship.draw(lcd); 00146 // printf("ship drawn"); 00147 00148 printScore(lcd); 00149 //printf("score displayed"); 00150 00151 /* Add all astroids to the lcd canvas */ 00152 for(char i = 0; i < 8; i++) { 00153 astroid.draw(lcd, i); 00154 } 00155 // printf("astroids spawning"); 00156 00157 /* Add all bullets to the lcd canvas */ 00158 for(char i = 0; i < 8; i++) { 00159 bullet.draw(lcd, i); 00160 } 00161 //printf("bullets in place"); 00162 00163 lcd.refresh(); 00164 } 00165 00166 /******************************************************************************* 00167 * Name: static void welcome(void) 00168 * 00169 * Description: Welcome screen. First interaction with the user. Includes music 00170 * player. 00171 * 00172 * Parameters: void 00173 * 00174 * Return: void 00175 ******************************************************************************/ 00176 static void welcome(void) 00177 { 00178 00179 lcd.printString(" S.T.A.R ",8,0); 00180 lcd.printString("SpecialTactics", 0,2); 00181 lcd.printString(" and Rescue ", 0,3); 00182 lcd.printString(" Press Start ", 0,5); 00183 lcd.refresh(); 00184 //printf("Strings Created"); 00185 00186 00187 float note[18]= {1568.0,1396.9,1244.5,1244.5,1396.9,1568.0,1568.0,1568.0,1396.9, 00188 1244.5,1396.9,1568.0,1396.9,1244.5,1174.7,1244.5,1244.5, 0.0 00189 }; 00190 float duration[40]= {0.48,0.24,0.72,0.48,0.24,0.48,0.24,0.24,0.24, 00191 0.24,0.24,0.24,0.24,0.48,0.24,0.48,0.48, 0.0 00192 }; 00193 //printf("music initialised"); 00194 00195 // setup instance of new SongPlayer class, mySpeaker using pin 26 00196 // the pin must be a PWM output pin 00197 SongPlayer mySpeaker(PTC10); 00198 // Start song and return once playing starts 00199 mySpeaker.PlaySong(note,duration); 00200 00201 // wait flashing LEDs until start button is pressed 00202 while ( pad.check_event(Gamepad::START_PRESSED) == false) { 00203 pad.leds_on(); 00204 wait(0.1); 00205 pad.leds_off(); 00206 wait(0.1); 00207 } 00208 //printf("start button pressed"); 00209 } 00210 00211 00212 /****************************************************************************** 00213 * Name: static game_init ( void) 00214 * 00215 * Description: Game initialisation function 00216 * 00217 * Parameters: void 00218 * 00219 * Return: void 00220 * 00221 *******************************************************************************/ 00222 static void game_init(void) 00223 { 00224 /* Initialise game components and peripherals */ 00225 lcd.init(); 00226 joystick.init(); 00227 pad.init(); 00228 bullet.init(); 00229 astroid.init(); 00230 } 00231 00232 /****************************************************************************** 00233 * Name: static bullet_run( Direction joy_dir ) 00234 * 00235 * Description: This function is the main loop/engine for 00236 * spawning bullets from the ship. Bullets are meant to be created 00237 behind the ship. 00238 * 00239 * Parameters: Direction joy_dir - Current joystick direction 00240 * 00241 * NOTE: POINT IN DIRECTION OF ASTROID USING THE JOYSTICK TO SHOOT BULLET. 00242 * JOYSICK MUST BE KEPT IN PLACE. 00243 * 00244 * Return: void 00245 *******************************************************************************/ 00246 static void bullet_run( Direction joy_dir ) 00247 { 00248 Vector2D pos; 00249 Vector2D vel; 00250 static char bull_id = 0; 00251 //printf("bullet id set to zero"); 00252 00253 /* If button is pressed, add bullet depending on ship orientation */ 00254 if( pad.check_event(Gamepad::A_PRESSED) == true) { 00255 switch(joy_dir) { 00256 case N: 00257 pos.x = 43; 00258 pos.y = 22; 00259 vel.x = 0; 00260 vel.y = -1; 00261 break; 00262 case NE: 00263 pos.x = 48; 00264 pos.y = 24; 00265 vel.x = 1; 00266 vel.y = -1; 00267 break; 00268 case E: 00269 pos.x = 48; 00270 pos.y = 24; 00271 vel.x = 1; 00272 vel.y = 0; 00273 break; 00274 case SE: 00275 pos.x = 48; 00276 pos.y = 24; 00277 vel.x = 1; 00278 vel.y = 1; 00279 break; 00280 case S: 00281 pos.x = 43; 00282 pos.y = 24; 00283 vel.x = 0; 00284 vel.y = 1; 00285 break; 00286 case SW: 00287 pos.x = 42; 00288 pos.y = 18; 00289 vel.x = -1; 00290 vel.y = 1; 00291 break; 00292 case W: 00293 pos.x = 40; 00294 pos.y = 24; 00295 vel.x = -1; 00296 vel.y = 0; 00297 break; 00298 case NW: 00299 pos.x = 44; 00300 pos.y = 32; 00301 vel.x = -1; 00302 vel.y = -1; 00303 break; 00304 default: 00305 pos.x = 34; 00306 pos.y = 26; 00307 vel.x = 0; 00308 vel.y = -1; 00309 break; 00310 } 00311 pad.tone(3000.0,0.1); 00312 00313 /* Lets add a new bullet to the canvas*/ 00314 bullet.set_velocity(vel, bull_id); 00315 bullet.set_pos(pos, bull_id); 00316 //printf("bullet created"); 00317 bull_id++; 00318 /* Don't exceed 8 bullets */ 00319 if(bull_id > 7) { 00320 bull_id = 0; 00321 } 00322 } 00323 /* Check if any bullet is now outside lcd limits */ 00324 bullet_out_of_bounds(); 00325 //printf("bullet out of bounds"); 00326 } 00327 00328 /****************************************************************************** 00329 * Name: static bullet_out_of_bounds( void ) 00330 * 00331 * Description: This function is the main loop/engine for 00332 * spawning astroids 00333 * 00334 * Parameters: void 00335 * 00336 * Return: void 00337 * 00338 *****************************************************************************/ 00339 static void astroid_run( void ) 00340 { 00341 /* Velocity update-rate for astroids, the bigger the value the slower the astroid */ 00342 const char cons_slow_down[8] = {8,10,8,15,9,11,14,20}; 00343 static char slow_down[8] = {8,10,8,15,9,11,14,20}; 00344 00345 /* Add astroids to the canvas */ 00346 for(char i = 0; i < 8; i++) { 00347 if(slow_down[i] == 0) { 00348 astroid.set_velocity(astr_vel[i], i); 00349 astroid.set_pos(astr_pos[i], i); 00350 astroid.update(i); 00351 astr_pos[i] = astroid.get_pos(i); 00352 00353 slow_down[i] = cons_slow_down[i]; 00354 } 00355 //printf("astroids slowed down"); 00356 00357 /* Reset the astroid to original position if now outside bounds */ 00358 if( 00359 (astr_pos[i].x > 80 ) || 00360 ( astr_pos[i].x < 1 ) || 00361 ( astr_pos[i].y > 49 )|| 00362 ( astr_pos[i].y < 1 ) 00363 ) { 00364 astr_pos[i] = og_pos[i]; 00365 astr_vel[i] = og_vel[i]; 00366 //printf("astroid position reset"); 00367 } 00368 slow_down[i]--; 00369 } 00370 } 00371 00372 /******************************************************************************* 00373 * Name: static bullet_out_of_bounds( void ) 00374 * 00375 * Description: This function checks if a bullet is outside 00376 * bounds/limits of lcd 00377 * 00378 * Parameters: void 00379 * 00380 * Return: void 00381 * 00382 *******************************************************************************/ 00383 static void bullet_out_of_bounds( void ) 00384 { 00385 Vector2D pos; 00386 Vector2D vel = {0,0}; 00387 00388 /* Reset/clear bullet if it's now outside lcd bounds */ 00389 for(char i = 0; i < 8; i++) { 00390 00391 /* Get bullet current position */ 00392 pos= bullet.get_pos(i); 00393 00394 /* Check if now outside lcd limits */ 00395 if( 00396 (pos.x > 80 ) || 00397 ( pos.x < 1 ) || 00398 ( pos.y > 49 )|| ( pos.y < 1 ) 00399 ) { 00400 pos.x = 44; 00401 pos.y = 24; 00402 bullet.set_pos(pos, i); 00403 bullet.set_velocity(vel, i); 00404 } 00405 //printf("bullet reset"); 00406 } 00407 } 00408 00409 /***************************************************************************** 00410 * Name: static void bullet_hits( void ) 00411 * 00412 * Description: This function checks for collisions between bullets and astroids* 00413 * 00414 * Parameters: void 00415 * 00416 * Return: void 00417 * 00418 ******************************************************************************/ 00419 static void bullet_hits( void ) 00420 { 00421 Vector2D bull_pos; 00422 Vector2D ast_pos; 00423 00424 /* Check if any bullet on the canvas has hit an astroid */ 00425 for(char i = 0; i < 8; i++) { 00426 00427 /* Get current position of bullet */ 00428 bull_pos = bullet.get_pos(i); 00429 //printf("bullet position set"); 00430 00431 for(char idx = 0; idx < 8; idx++) { 00432 00433 /* Get current position of astroid */ 00434 ast_pos = astroid.get_pos(idx); 00435 //printf("astroid position set"); 00436 00437 ship.get_userScore(); 00438 //printf("user score retrieved"); 00439 00440 /* Check for collision by creating a hit box plus/minus 1 unit around 00441 the x and y coordinates ofthe astroids*/ 00442 00443 if 00444 ( 00445 ((bull_pos.x == ast_pos.x ) && (bull_pos.y == ast_pos.y))|| 00446 (((bull_pos.x + 1) == ast_pos.x ) && (bull_pos.y == ast_pos.y))|| 00447 ((bull_pos.x == ast_pos.x ) && ((bull_pos.y + 1) == ast_pos.y))|| 00448 (((bull_pos.x - 1) == ast_pos.x ) && (bull_pos.y == ast_pos.y))|| 00449 ((bull_pos.x == ast_pos.x ) && ((bull_pos.y - 1) == ast_pos.y))|| 00450 (((bull_pos.x - 1)== ast_pos.x ) && ((bull_pos.y - 1) == ast_pos.y))|| 00451 (((bull_pos.x + 1) == ast_pos.x ) && ((bull_pos.y + 1) == ast_pos.y))|| 00452 (((bull_pos.x - 1) == ast_pos.x ) && ((bull_pos.y + 1) == ast_pos.y))|| 00453 (((bull_pos.x + 1) == ast_pos.x ) && ((bull_pos.y - 1) == ast_pos.y)) 00454 00455 ) { 00456 //printf("collision observed"); 00457 astr_pos[idx] = og_pos[0]; 00458 astr_vel[idx] = og_vel[0]; 00459 //printf("astroids returned"); 00460 00461 ship.add_userScore(); 00462 //printf("score updated"); 00463 00464 /* Returning the bullet after a collision */ 00465 Direction joy_dir; 00466 Vector2D pos; 00467 Vector2D vel; 00468 static char bull_id = 0; 00469 switch(joy_dir) { 00470 default: 00471 pos.x = 44; 00472 pos.y = 22; 00473 vel.x = 0; 00474 vel.y = 0; 00475 break; 00476 } 00477 bullet.set_velocity(vel, bull_id); 00478 bullet.set_pos(pos, bull_id); 00479 bull_id++; 00480 00481 if(bull_id > 7) { 00482 bull_id = 0; 00483 } 00484 //printf("bullet returned"); 00485 00486 lcd.refresh(); 00487 } 00488 } 00489 } 00490 } 00491 00492 /************************************************************************** 00493 * Name: static void gameOver(Gamepad &pad, N5110 &lcd) 00494 * 00495 * Description: This function creates the game over sequence that is displayed 00496 * when any one of the astroids collides with the ship. 00497 * 00498 * Parameters: &pad and &lcd 00499 * 00500 * Return: Does not return 00501 * 00502 * 00503 ***************************************************************************/ 00504 static void gameOver(Gamepad &pad, N5110 &lcd) 00505 { 00506 lcd.clear(); 00507 lcd.normalMode(); 00508 //First Messgae 00509 lcd.printString("Mission Failed",0,2); 00510 lcd.printString(" Commandor! ",0,3); 00511 lcd.refresh(); 00512 wait(2); 00513 //printf("first message displayed"); 00514 00515 pad.tone(250.0,0.1); //end sequence tone initiated 00516 wait(0.4); 00517 pad.tone(240.0,0.1); 00518 wait(0.3); 00519 pad.tone(150.0,0.1); 00520 wait(0.2); 00521 pad.tone(50.0,0.1); 00522 //printf("end sequence tone played"); 00523 00524 lcd.clear(); 00525 pad.leds_on(); 00526 00527 int score = ship.get_userScore(); 00528 //sprintf("%2d", score); 00529 00530 // print to LCD 00531 char buffer1[21]; 00532 sprintf(buffer1,"%2d",score); 00533 //Second message 00534 lcd.printString("Score" ,28,2); 00535 lcd.printString(buffer1,36,3); 00536 //Users score determines users overall performance rank 00537 while(1) { 00538 if(score <= 50) { 00539 lcd.printString(" Try Harder! ",0,0); 00540 //printf("Try Harder"); 00541 } else if(score > 50 && score <= 100) { 00542 lcd.printString("Valient Effort!",0,0); 00543 //printf("Valient Effort"); 00544 } else { 00545 lcd.printString("Medal of Honor!",0,0); 00546 //printf("Medal of Honor"); 00547 } 00548 lcd.refresh(); 00549 wait(1.5); 00550 } 00551 } 00552 00553 /***************************************************************************** 00554 * Name: static void asteroid_hits( void ) 00555 * 00556 * Description: This function checks for collisions 00557 * between ship and astroids 00558 * 00559 * Parameters: void 00560 * 00561 * Return: void 00562 * 00563 ******************************************************************************/ 00564 static void asteroid_hits( void ) 00565 { 00566 Vector2D ship_pos; 00567 Vector2D ast_pos; 00568 00569 ship_pos = ship.get_pos(); 00570 //printf("ship postition updated"); 00571 00572 for(char idx = 0; idx < 8; idx++) { 00573 ast_pos = astroid.get_pos(idx); 00574 00575 /*checking for collisions between the astroids and the ship. Bullets are 00576 given a wider impact area*/ 00577 if 00578 ( 00579 ((ast_pos.x == ship_pos.x ) || (ast_pos.y== ship_pos.y))|| 00580 (((ast_pos.x + 2) == ship_pos.x) || (ast_pos.y == ship_pos.y))|| 00581 ((ast_pos.x == ship_pos.x) || ((ast_pos.y + 2) == ship_pos.y))|| 00582 (((ast_pos.x - 2) == ship_pos.x) || (ast_pos.y == ship_pos.y))|| 00583 ((ast_pos.x == ship_pos.x) ||((ast_pos.y - 2) == ship_pos.y))|| 00584 (((ast_pos.x - 2) == ship_pos.x) || ((ast_pos.y - 2)== ship_pos.y))|| 00585 (((ast_pos.x + 2) == ship_pos.x) || ((ast_pos.y + 2) == ship_pos.y)) 00586 ) { 00587 //printf("Collision observed"); 00588 pad.tone (500, 0.5); 00589 gameOver(pad, lcd); 00590 } 00591 } 00592 } 00593 00594 /****************************************************************************** 00595 * Name: countDown() and origins() 00596 * 00597 * Description: Gives the background to the game and allows the user the oppoturnity 00598 * to read the instrctions. 00599 * 00600 * Parameters: void 00601 * 00602 * Return: void 00603 * 00604 *******************************************************************************/ 00605 static void countDown(void) 00606 { 00607 lcd.clear(); 00608 00609 lcd.printString("######",26,0); 00610 lcd.printString("#",56,1); 00611 lcd.printString("######",26,2); 00612 lcd.printString("#",56,3); 00613 lcd.printString("######",26,4); 00614 wait(1); 00615 lcd.refresh(); 00616 //printf("3"); 00617 00618 lcd.clear(); 00619 lcd.printString("######",26,0); 00620 lcd.printString("#",56,1); 00621 lcd.printString("######",26,2); 00622 lcd.printString("#",26,3); 00623 lcd.printString("######",26,4); 00624 wait(1); 00625 lcd.refresh(); 00626 ////printf("2"); 00627 00628 lcd.clear(); 00629 lcd.printString("######",26,0); 00630 lcd.printString("#",56,1); 00631 lcd.printString("######",26,2); 00632 lcd.printString("#",26,3); 00633 lcd.printString("######",26,4); 00634 wait(1); 00635 lcd.refresh(); 00636 //printf("1"); 00637 } 00638 00639 static void origins(void) 00640 { 00641 lcd.clear(); 00642 00643 //Background - pt1 00644 lcd.printString("Incoming Alert",0,0); 00645 lcd.printString(" Approaching ",0,2); 00646 lcd.printString(" Astroid Belt! ", 0,3); 00647 lcd.printString(" Avoid at all ",0,4); 00648 lcd.printString(" costs! ",0,5); 00649 lcd.refresh(); 00650 wait(3); 00651 //pt2 00652 lcd.clear(); 00653 lcd.printString(" Commander, ",0,1); 00654 lcd.printString("Weapons AreHot",0,2); 00655 lcd.printString(" I repeat ", 0,3); 00656 lcd.printString("WeaponsareHot!",0,4); 00657 lcd.refresh(); 00658 wait(2); 00659 00660 countDown(); 00661 } 00662 00663 /***************************************************************************** 00664 * Name: printScore(N5110 &lcd) 00665 * 00666 * Description: Printing the scores. 00667 * 00668 * Parameters: &lcd only. 00669 * 00670 * Return: Does not return. 00671 * 00672 ******************************************************************************/ 00673 static void printScore(N5110 &lcd) 00674 { 00675 // get scores from paddles 00676 int score = ship.get_userScore(); 00677 00678 // print to LCD 00679 char buffer1[14]; 00680 sprintf(buffer1,"%2d",score); 00681 lcd.printString(buffer1,20,0); 00682 } 00683 00684 /***************************************************************************** 00685 * Name: Menu Initialisation 00686 * 00687 * Description: Creating a menu for the user. 00688 * 00689 * Parameters: void 00690 * 00691 * Return: Does not return. 00692 * 00693 ******************************************************************************/ 00694 static void subMenu(void) 00695 { 00696 lcd.clear(); 00697 lcd.printString(" >Main Menu< ",0,0); 00698 lcd.printString("@ START - X ",0,2); 00699 lcd.printString("@ HELP - Y ",0,3); 00700 lcd.refresh(); 00701 } 00702 00703 static void mainMenu(void) 00704 { 00705 /* Inital screen the user interacts with */ 00706 subMenu(); 00707 00708 while ( pad.check_event(Gamepad::X_PRESSED) == false) { 00709 // settings 00710 if (pad.check_event(Gamepad::Y_PRESSED) == true) { 00711 lcd.clear(); 00712 pad.tone(200,0.1); 00713 lcd.printString(" >> HELP << ",0,0); 00714 lcd.printString("@SHOOT - A ",0,2); 00715 lcd.printString("@Bullet-JoyDirc",0,3); 00716 lcd.printString("@Brightness- P",0,4); 00717 lcd.printString("@Back - Back",0,5); 00718 lcd.refresh(); 00719 } 00720 00721 lcd.clear(); 00722 // back function 00723 if (pad.check_event(Gamepad::BACK_PRESSED) == true) { 00724 subMenu(); 00725 pad.tone(200,0.1); 00726 00727 } 00728 lcd.clear(); 00729 } 00730 } 00731 00732 /***************************************************************************** 00733 * Name: lcdControl() 00734 * 00735 * Description: This function is used to alter the brightness of the lcd display. 00736 * The user can change the brightness by altering the angle of the 00737 * potentiometer. 00738 * 00739 * Used once the game officially starts. 00740 * 00741 * Parameters: void 00742 * 00743 * Return: Does not return. 00744 * 00745 ******************************************************************************/ 00746 static void lcdControl(void) 00747 { 00748 float LCD_backlight = pad.read_pot(); 00749 lcd.setBrightness(LCD_backlight); 00750 lcd.refresh(); 00751 }
Generated on Thu Jul 14 2022 12:35:14 by
1.7.2