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
Diff: voiceecho.cpp
- Revision:
- 2:718d996170c2
- Parent:
- 1:5972dbd390c8
- Child:
- 3:8ed0851755d7
--- a/voiceecho.cpp Wed Apr 17 04:53:40 2019 +0000
+++ b/voiceecho.cpp Fri Apr 19 04:11:04 2019 +0000
@@ -1,3 +1,10 @@
+/* voiceecho.cpp */
+// voice input to ADC is delayed for 0.1 to 0.5 sec and output to DAC and PWM
+// Copyright Toshihiro Matsui, IISEC, April 2019
+// Any use/copy/modify of this program is fully granted to anyone by the author.
+//
+
+
#include "mbed.h"
DigitalOut led1(LED1);
@@ -79,7 +86,7 @@
void voice_io() /*timer driven*/
{ unsigned short val;
- wave[readindex]= mic.read_u16(); //mic.read()*30000;
+ wave[readindex]= wave[readindex]*0.4+mic.read_u16()*0.6; //mic.read()*30000;
val=wave[writeindex];
pwm.write((float)val/65536.0);
spk.write_u16(val); // (val/30000.0 );