for percussion1

Dependencies:   mbed

Fork of penkich_test_percussion by kitac_mbed_WS

Files at this revision

API Documentation at this revision

Comitter:
penkich
Date:
Sun Aug 30 07:28:07 2015 +0000
Parent:
2:269fadd5d1f2
Commit message:
penkich_percussion_1_LPC1114

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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);
     }