Dependencies:   mbed

Fork of penkich_test_percussion by kitac_mbed_WS

Files at this revision

API Documentation at this revision

Comitter:
hagi_hara
Date:
Sun Aug 30 05:45:12 2015 +0000
Parent:
2:269fadd5d1f2
Commit message:
???????

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 269fadd5d1f2 -r 94639c311dd1 main.cpp
--- a/main.cpp	Sun Aug 23 10:27:57 2015 +0000
+++ b/main.cpp	Sun Aug 30 05:45:12 2015 +0000
@@ -1,6 +1,10 @@
 #include "mbed.h"
 
-DigitalIn sw(D7);
+
+AnalogIn cds(A5);
+
+//シリアル通信設定
+Serial pc(USBTX, USBRX);
 
 Ticker timer;
 PwmOut speaker(D5);
@@ -39,14 +43,17 @@
      
 int main()
 {
-    sw.mode(PullUp);
+    float cdsValue = cds;
     while(1){
-        if (sw ==0){
+        cdsValue = cds;
+        pc.printf("%f, ", cdsValue);
+        if (cds > 0.2){
             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);
     }
diff -r 269fadd5d1f2 -r 94639c311dd1 mbed.bld
--- a/mbed.bld	Sun Aug 23 10:27:57 2015 +0000
+++ b/mbed.bld	Sun Aug 30 05:45:12 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/b9ad9a133dc7
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/8ed44a420e5c
\ No newline at end of file