圧電ブザーをwaitなしで好きなように鳴らすライブラリ

Dependents:   Tourobo2022_TBCMotorDriver

Revision:
0:97f383c12e42
Child:
1:96bd2135c3bf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buzzer.h	Thu Oct 03 09:34:57 2019 +0000
@@ -0,0 +1,20 @@
+#ifndef BUZZER_H
+#define BUZZER_H
+#include "mbed.h"
+
+class buzzer {
+    public:
+        buzzer(PinName buzzerPin);
+        void output(unsigned int count,float period);
+        void output(bool buzzerStates);
+        void stop();
+    private:
+        DigitalOut _buzzer;
+        Ticker     _timer;
+        
+        void timerFunction();
+        int _counter,_setCount,_timerFlag;
+          
+};
+
+#endif
\ No newline at end of file