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 ProjetInfo2_Multi by
Diff: music.h
- Revision:
- 1:d446f0124474
- Child:
- 2:ae058dfdebac
diff -r 5755bf39c144 -r d446f0124474 music.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/music.h Tue May 22 11:51:24 2018 +0000
@@ -0,0 +1,21 @@
+// Oranges and Lemons program
+#include "mbed.h"
+PwmOut HP(p23);
+void music (void);
+int y=0;
+float frequence[]={659,554,659,554,550,494,554,587,
+494,659,554,440};
+ //frequency array
+float beat[]={1,1,1,1,1,0.5,0.5,1,1,1,1,2}; //beat array
+void music() {
+ while (y<1) {
+ for (int i=0; i<=11; i++) {
+ HP.period(1/(frequence[i])); // set PWM period
+ HP.write(0.5); // set duty cycle
+ wait(0.5*beat[i]); // hold for beat period
+ y++;
+ }
+ }
+ HP.period(0);
+ y=0;
+}
