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 wave_player mbed-rtos 4180Final SDFileSystem
Diff: main.cpp
- Revision:
- 7:1c87d89b74f1
- Parent:
- 6:65216abe57c3
diff -r 65216abe57c3 -r 1c87d89b74f1 main.cpp
--- a/main.cpp Wed Apr 29 00:00:16 2020 +0000
+++ b/main.cpp Wed Apr 29 03:11:28 2020 +0000
@@ -12,6 +12,7 @@
#include "wave_player.h"
#include "rtos.h"
#include "menumusic.h"
+#include "Speaker.h"
Nav_Switch myNav(p9, p6, p7, p5, p8); //pin order on Sparkfun breakout
uLCD_4DGL uLCD(p28, p27, p30); // serial tx, serial rx, reset pin;
@@ -22,6 +23,7 @@
AnalogOut DACout(p18);
DigitalOut led(LED2);
PwmOut myled3(LED3);
+Speaker mySpeaker(p18);
Thread thread1, thread2;
@@ -50,6 +52,38 @@
int main();
void play();
+//Method to create count down till game starts
+void countdown() {
+ uLCD.cls();
+ uLCD.background_color(BLACK);
+ uLCD.textbackground_color(BLACK);
+ wait(0.5);
+ uLCD.cls();
+ uLCD.color(GREEN);
+ uLCD.locate(1,0);
+ uLCD.text_height(2);
+ uLCD.text_width(2);
+ uLCD.printf("Ready");
+ mySpeaker.PlayNote(600.0, 0.5, 0.5);
+ wait(1);
+ uLCD.cls();
+ uLCD.color(GREEN);
+ uLCD.locate(1,0);
+ uLCD.text_height(2);
+ uLCD.text_width(2);
+ uLCD.printf("Set ");
+ mySpeaker.PlayNote(600.0, 0.5, 0.5);
+ wait(1);
+ uLCD.cls();
+ uLCD.color(GREEN);
+ uLCD.locate(1,0);
+ uLCD.text_height(2);
+ uLCD.text_width(2);
+ uLCD.printf("SHOUT!!!");
+ mySpeaker.PlayNote(600.0, 0.5, 0.5);
+ wait(1);
+}
+
// Method for ticker for sound
void playMenuMusic() {
@@ -364,6 +398,7 @@
}
void play() {
+ countdown();
uLCD.background_color(GREEN);
uLCD.cls();
uLCD.filled_rectangle(0, 0, 200, 15, RED);
