kohacraft Lab
/
kc_sample_mbed_sp2
マクドナルドのポテトが揚がった音を止められるよにしよう
Diff: main.cpp
- Revision:
- 0:c0b6adb7c5e8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 16 00:35:27 2015 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +DigitalOut myled(LED1); +DigitalIn sw(dp15); + +int main() { + while(1) { + for( int i = 0 ; i<200 ; i++ ) + { + myled = 1; + wait( 1.0 /784.0 /2.0 ); + myled = 0; + wait( 1.0 /784.0 /2.0 ); + } + for( int i = 0 ; i<180 ; i++ ) + { + myled = 1; + wait( 1.0 /698.5 /2.0 ); + myled = 0; + wait( 1.0 /698.5 /2.0 ); + } + for( int i = 0 ; i<200 ; i++ ) + { + myled = 1; + wait( 1.0 /784.0 /2.0 ); + myled = 0; + wait( 1.0 /784.0 /2.0 ); + } + wait(0.2); + if( sw == 1 ) + { + wait( 5 ); + } + } +}