mech / Mbed 2 deprecated photo_interrupter

Dependencies:   mbed

Revision:
0:53668fb4591a
Child:
1:395831e5d094
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 13 18:31:05 2018 +0000
@@ -0,0 +1,30 @@
+#include "function.h"
+
+InterruptIn button1(A1);    //フォトインタラプタ
+InterruptIn button2(A2);    //フォトインタラプタ
+
+PwmOut dout1(D1);
+PwmOut dout5(D5);
+PwmOut dout6(D6);
+PwmOut dout9(D9);
+
+int main() {
+        dout1.period(0.01f); //100Hz
+        dout5.period(0.01f); //100Hz
+        dout6.period(0.01f); //100Hz
+        dout9.period(0.01f); //100Hz
+        
+        while(1) {
+        
+        dout1.write(0.5f);  //50% duty
+        dout5.write(0.4f);  //50% duty
+        dout6.write(0.2f);  //50% duty
+        dout9.write(0.6f);  //50% duty
+        
+        printf("%d\n",count1);
+        printf("%d\n\n",count2);
+        count1 = 0;
+        count2 = 0;
+        wait(1);
+    }
+}