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
menu_funtions/menu.h
- Committer:
- el14jpps
- Date:
- 2016-05-05
- Revision:
- 5:722864843189
- Parent:
- 0:bf56ee79c09e
- Child:
- 9:80898ce9d4d5
File content as of revision 5:722864843189:
/**
@file menu.h
@brief Header file containing funtions used for my menu .
@code The library N5110 belongs to Dr Evans
*/
#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);
}