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.
Fork of blip_playnotes by
Diff: main.cpp
- Revision:
- 3:a6355b9de221
- Parent:
- 2:85d8ce475baa
- Child:
- 4:e80a13a4e8eb
--- a/main.cpp Thu Nov 26 09:28:03 2015 +0000
+++ b/main.cpp Sun Nov 29 12:43:58 2015 +0000
@@ -3,6 +3,8 @@
#include "mbed.h"
#include "SongPlayer.h"
+#include "notes.h"
+
//Set up notes and durations for sample song to play
// A 0.0 duration note at end terminates song play
@@ -13,12 +15,72 @@
0.24,0.24,0.24,0.24,0.48,0.24,0.48,0.48, 0.0
};
+
+//Mario main theme melody
+int melody[] = {
+ NOTE_E7, NOTE_E7, 0, NOTE_E7,
+ 0, NOTE_C7, NOTE_E7, 0,
+ NOTE_G7, 0, 0, 0,
+ NOTE_G6, 0, 0, 0,
+
+ NOTE_C7, 0, 0, NOTE_G6,
+ 0, 0, NOTE_E6, 0,
+ 0, NOTE_A6, 0, NOTE_B6,
+ 0, NOTE_AS6, NOTE_A6, 0,
+
+ NOTE_G6, NOTE_E7, NOTE_G7,
+ NOTE_A7, 0, NOTE_F7, NOTE_G7,
+ 0, NOTE_E7, 0, NOTE_C7,
+ NOTE_D7, NOTE_B6, 0, 0,
+
+ NOTE_C7, 0, 0, NOTE_G6,
+ 0, 0, NOTE_E6, 0,
+ 0, NOTE_A6, 0, NOTE_B6,
+ 0, NOTE_AS6, NOTE_A6, 0,
+
+ NOTE_G6, NOTE_E7, NOTE_G7,
+ NOTE_A7, 0, NOTE_F7, NOTE_G7,
+ 0, NOTE_E7, 0, NOTE_C7,
+ NOTE_D7, NOTE_B6, 0, 0
+};
+//Mario main them tempo
+int tempo[] = {
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+
+ 9, 9, 9,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+
+ 9, 9, 9,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+};
+
+
int main()
{
// Buzzer pin
SongPlayer mySpeaker(P0_8);
// Start song and return once playing starts
- mySpeaker.PlaySong(note,duration);
+ //mySpeaker.PlaySong(note,duration);
+
+ mySpeaker.PlaySong(melody,tempo);
+
// loops forever while song continues to play to end using interrupts
while(1) {
wait(.1);
