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 4DGL-uLCD-SE
Diff: main.cpp
- Revision:
- 1:fc3efaef8625
- Parent:
- 0:ce3fa8a3840c
--- a/main.cpp Sun Dec 08 18:56:02 2019 +0000
+++ b/main.cpp Mon Dec 09 13:02:42 2019 +0000
@@ -1,12 +1,14 @@
#include "mbed.h"
#include "uLCD_4DGL.h"
#include "Speaker.h"
+#include "SongPlayer.h"
AnalogIn light1(p19);
AnalogIn light2(p18);
DigitalIn button(p8);
DigitalOut led(p26);
-PwmOut speaker(p25);
+//PwmOut speaker(p25);
+SongPlayer spearker(p25);
DigitalOut mag2(p20);
DigitalOut mag1(p21);
@@ -131,18 +133,23 @@
mag2 = 0;
l2.used = 0;
} else {
- uLCD.printf("\nInvlaid locker and code combination");
+ uLCD.printf("\nInvalid locker and code combination");
+ float note[18]= {1568.0};
+ float duration[18]= {0.5};
led = 1;
- speaker = .5;
+ spearker.PlaySong(note, duration);
+// speaker = .5;
wait(.5);
led = 0;
- speaker = 0;
+// speaker = 0;
wait(.5);
led = 1;
- speaker = .5;
+
+ spearker.PlaySong(note, duration);
+// speaker = .5;
wait(.5);
led = 0;
- speaker = 0;
+// speaker = 0;
wait(.5);
}
@@ -174,7 +181,7 @@
int main() {
mag1 = 0;
mag2 = 0;
- speaker.period(1.0/5000.0);
+// speaker.period(1.0/20000.0);
while(1){
uLCD.locate(0,0);
uLCD.printf("Welcome to\n our locker"); //Default Green on black text