mech / Mbed 2 deprecated photo_interrupter

Dependencies:   mbed

Committer:
isshikiyuya
Date:
Thu Dec 13 18:31:05 2018 +0000
Revision:
0:53668fb4591a
Child:
1:395831e5d094
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
isshikiyuya 0:53668fb4591a 1 #include "function.h"
isshikiyuya 0:53668fb4591a 2
isshikiyuya 0:53668fb4591a 3 InterruptIn button1(A1); //フォトインタラプタ
isshikiyuya 0:53668fb4591a 4 InterruptIn button2(A2); //フォトインタラプタ
isshikiyuya 0:53668fb4591a 5
isshikiyuya 0:53668fb4591a 6 PwmOut dout1(D1);
isshikiyuya 0:53668fb4591a 7 PwmOut dout5(D5);
isshikiyuya 0:53668fb4591a 8 PwmOut dout6(D6);
isshikiyuya 0:53668fb4591a 9 PwmOut dout9(D9);
isshikiyuya 0:53668fb4591a 10
isshikiyuya 0:53668fb4591a 11 int main() {
isshikiyuya 0:53668fb4591a 12 dout1.period(0.01f); //100Hz
isshikiyuya 0:53668fb4591a 13 dout5.period(0.01f); //100Hz
isshikiyuya 0:53668fb4591a 14 dout6.period(0.01f); //100Hz
isshikiyuya 0:53668fb4591a 15 dout9.period(0.01f); //100Hz
isshikiyuya 0:53668fb4591a 16
isshikiyuya 0:53668fb4591a 17 while(1) {
isshikiyuya 0:53668fb4591a 18
isshikiyuya 0:53668fb4591a 19 dout1.write(0.5f); //50% duty
isshikiyuya 0:53668fb4591a 20 dout5.write(0.4f); //50% duty
isshikiyuya 0:53668fb4591a 21 dout6.write(0.2f); //50% duty
isshikiyuya 0:53668fb4591a 22 dout9.write(0.6f); //50% duty
isshikiyuya 0:53668fb4591a 23
isshikiyuya 0:53668fb4591a 24 printf("%d\n",count1);
isshikiyuya 0:53668fb4591a 25 printf("%d\n\n",count2);
isshikiyuya 0:53668fb4591a 26 count1 = 0;
isshikiyuya 0:53668fb4591a 27 count2 = 0;
isshikiyuya 0:53668fb4591a 28 wait(1);
isshikiyuya 0:53668fb4591a 29 }
isshikiyuya 0:53668fb4591a 30 }