for percussion1

Dependencies:   mbed

Fork of penkich_test_percussion by kitac_mbed_WS

Revision:
3:396b2628e3d7
Parent:
2:269fadd5d1f2
diff -r 269fadd5d1f2 -r 396b2628e3d7 main.cpp
--- a/main.cpp	Sun Aug 23 10:27:57 2015 +0000
+++ b/main.cpp	Sun Aug 30 07:28:07 2015 +0000
@@ -1,11 +1,11 @@
 #include "mbed.h"
 
-DigitalIn sw(D7);
+AnalogIn sw(dp9);
 
 Ticker timer;
-PwmOut speaker(D5);
+PwmOut speaker(dp1);
 Ticker envelope;
-PwmOut env(D3);
+PwmOut env(dp2);
 static int tms_per10=0; 
 
 void env_out(void){
@@ -39,14 +39,15 @@
      
 int main()
 {
-    sw.mode(PullUp);
+//    sw.mode(PullUp);
     while(1){
-        if (sw ==0){
+        if (sw >= 0.3f){
             tms_per10=0; 
             speaker.period_us(10);
             env.period_us(10);
             timer.attach_us(&sound_out,100); //10kHz
             envelope.attach_us(&env_out,100); //10kHz
+//            wait(1.0f);
         }
     wait(0.01f);
     }