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: N5110 Ping_Pong beep mbed Servo
Diff: menu_funtions/menu.h
- Revision:
- 0:bf56ee79c09e
- Child:
- 5:722864843189
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/menu_funtions/menu.h Wed May 04 23:27:07 2016 +0000 @@ -0,0 +1,106 @@ +/** +@file menu.h +@brief Header file containing funtions used for my menu . + +*/ +#include "N5110.h" +#include "beep.h" +N5110 lcd1(PTE26 , PTA0 , PTC4 , PTD0 , PTD2 , PTD1 , PTC3); +Beep buzzer(PTA2); + +void pongGame(); +/** This is a funtion made for the whole code + */ +void gameOfLife(); +void calibrateJoystick(); +void updateJoystick(); +void menu_intro() +{ + lcd1.init(); // This funtion is used to inisicalise the lcd + lcd1.setBrightness(0); + wait(1); + lcd1.setBrightness(1); + lcd1.printString("LOADING. ",5,2); + wait(1); + //buzzer.beep(1500,0.5); + lcd1.setBrightness(0); + wait(1); + lcd1.setBrightness(1); + lcd1.clear(); + lcd1.printString("LOADING.. ",5,2); + // buzzer.beep(1000,0.5); + lcd1.setBrightness(1); + wait(1); + lcd1.setBrightness(0); + wait(1); + lcd1.clear(); + lcd1.printString("LOADING...",5,2); + // buzzer.beep(900,0.5); + lcd1.setBrightness(1); + wait(1); + lcd1.setBrightness(0); + wait(1); + lcd1.printString("LOADING...",5,2); + // buzzer.beep(800,0.5); + lcd1.setBrightness(1.0); + + + +// the following funtions are to make different buzzer increase in size to make it look like a explosion. + lcd1.drawCircle(WIDTH/2,HEIGHT/2,8,1); // x,y,radius,black fill. + buzzer.beep(500,0.5); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,10,2); // x,y,radius,white fill. + wait(0.020); + buzzer.beep(600,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,15,1); // x,y,radius,transparent with outline. + wait(0.030); + buzzer.beep(700,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,20,0); + wait(0.020); + buzzer.beep(800,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,25,1); // x,y,radius,white fill. + wait(0.030); + buzzer.beep(900,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,30,1); // x,y,radius,transparent with outline. + wait(0.020); + buzzer.beep(1000,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,35,2); + wait(0.030); + buzzer.beep(1200,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,40,1); // x,y,radius,white fill. + wait(0.020); + buzzer.beep(1300,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,45,0); // x,y,radius,transparent with outline. + wait(0.030); + buzzer.beep(1400,0.2); + lcd1.drawCircle(WIDTH/2,HEIGHT/2,50,2); + wait(0.020); + buzzer.beep(1500,0.2); + + lcd1.refresh(); // need to refresh screen after drawing buzzer. + lcd1.clear(); + +} +void tone1() +{ + + buzzer.beep(1500,0.1); + wait(0.3); + buzzer.beep(1500,0.2); + buzzer.beep(1500,0.3); + buzzer.beep(1500,0.4); + buzzer.beep(1500,0.5); + +} +void tone2() +{ + buzzer.beep(400,0.5); + wait(0.1); + buzzer.beep(600,0.4); + wait(0.1); + buzzer.beep(500,0.3); + wait(0.1); + buzzer.beep(400,0.2); + wait(0.1); + +}