Hirotaka Yoneda / beep_sound

Dependents:   kiokuryoku_game escapeFromYou junirobo_sample001 ROBOX_Sample_IRcon ... more

Revision:
10:24155220eeda
Parent:
9:d899b134f9bb
Child:
11:561f2d3f7c4b
--- a/beep_sound.cpp	Sat Oct 08 19:04:56 2016 +0000
+++ b/beep_sound.cpp	Sat Oct 08 19:28:44 2016 +0000
@@ -108,6 +108,13 @@
     beep_sound::NoteOn(octave, note);
     interruptStop.attach(this, &beep_sound::stop, time_s);
 }
+void beep_sound::onpu_stop(int octave, int note, float time_s)
+{
+    playing = true;
+    beep_sound::NoteOn(octave, note);
+    wait(time_s);
+    m_pwm->write(0.0f);
+}
 void beep_sound::sinwave(float center,int speed,int width)
 {
     for(float i=0.0f;i<6.28f;i+=0.01*speed)
@@ -178,16 +185,15 @@
 }
 void beep_sound::beep_readyGo(int nTimes)
 {
-    for (int i = 0; i < nTimes; i++) {
-        beep_sound::setGakuhu(1,0,0.5);
-        beep_sound::setKyuhu(0.5);
-        beep_sound::setGakuhu(1,0,0.5);
-        beep_sound::setKyuhu(0.5);
-        beep_sound::setGakuhu(1,0,0.5);
-        beep_sound::setKyuhu(0.5);
-        beep_sound::setGakuhu(2,0,1);
-    }
-    beep_sound::playGakuhu();
+    //for (int i = 0; i < nTimes; i++) {
+        beep_sound::onpu_stop(1,0,0.5);
+        wait(0.5);
+        beep_sound::onpu_stop(1,0,0.5);
+        wait(0.5);
+        beep_sound::onpu_stop(1,0,0.5);
+        wait(0.5);
+        beep_sound::onpu(2,0,1);
+    //}
 }
 void beep_sound::beep_encount(int nTimes)
 {