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.
Diff: main.cpp
- Revision:
- 4:e2b93a33645b
- Parent:
- 3:4e4bd058ef5d
- Child:
- 5:920db2f3019c
--- a/main.cpp Wed Feb 26 01:40:11 2014 +0000
+++ b/main.cpp Wed Feb 26 02:07:15 2014 +0000
@@ -5,6 +5,8 @@
AnalogIn pot1(p19);
AnalogIn pot2(p20);
+AnalogIn mic(p17);
+AnalogOut voice(p18);
PwmOut speaker(p26);
DigitalIn down(p12);
DigitalIn left(p13);
@@ -13,6 +15,7 @@
DigitalIn right(p16);
I2C master(p9, p10);
C12832 lcd(p5, p7, p6, p8, p11);
+
static char addr = 0x42;
static char read = 0x01;
unsigned char tempo;
@@ -375,6 +378,7 @@
int main()
{
while (1) {
+ voice.write(mic.read());
if(left) {
float topBeat=aliveBeatLyrics[1];
float backBeat=aliveBackBeat[0];
@@ -408,7 +412,7 @@
note = notes[freqLocal];
//term.printf("Note num: %d\r\n", freq);
speaker.period( 1 / (2 * note));
- speaker = .0;
+ speaker = .5;
if(topBeat>backBeat) {
wait(backBeat*modifier);
topBeat=topBeat-backBeat;