Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- isshikiyuya
- Date:
- 2018-12-17
- Revision:
- 2:2d54c60eef4c
- Parent:
- 1:395831e5d094
File content as of revision 2:2d54c60eef4c:
#include "mbed.h" InterruptIn button1(A2); //フォトインタラプタ InterruptIn button2(A1); //フォトインタラプタ int count1 = 0; int count2 = 0; PwmOut dout1(D1); PwmOut dout5(D5); PwmOut dout6(D6); PwmOut dout9(D9); void flip1() { count1++; } void flip2() { count2++; } int main() { dout1.period(0.01f); //100Hz dout5.period(0.01f); //100Hz dout6.period(0.01f); //100Hz dout9.period(0.01f); //100Hz button1.rise(&flip1); button2.rise(&flip2); while(1) { dout1.write(0.5f); // duty dout5.write(0.4f); // duty dout6.write(0.2f); // duty dout9.write(0.6f); // duty printf("左%d\n",count1); printf("右%d\n\n",count2); count1 = 0; count2 = 0; wait(1); } }