kohacraft Lab
/
kc_sample_mbed_sp2
マクドナルドのポテトが揚がった音を止められるよにしよう
main.cpp@0:c0b6adb7c5e8, 2015-12-16 (annotated)
- Committer:
- kohacraft
- Date:
- Wed Dec 16 00:35:27 2015 +0000
- Revision:
- 0:c0b6adb7c5e8
ver1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kohacraft | 0:c0b6adb7c5e8 | 1 | #include "mbed.h" |
kohacraft | 0:c0b6adb7c5e8 | 2 | |
kohacraft | 0:c0b6adb7c5e8 | 3 | DigitalOut myled(LED1); |
kohacraft | 0:c0b6adb7c5e8 | 4 | DigitalIn sw(dp15); |
kohacraft | 0:c0b6adb7c5e8 | 5 | |
kohacraft | 0:c0b6adb7c5e8 | 6 | int main() { |
kohacraft | 0:c0b6adb7c5e8 | 7 | while(1) { |
kohacraft | 0:c0b6adb7c5e8 | 8 | for( int i = 0 ; i<200 ; i++ ) |
kohacraft | 0:c0b6adb7c5e8 | 9 | { |
kohacraft | 0:c0b6adb7c5e8 | 10 | myled = 1; |
kohacraft | 0:c0b6adb7c5e8 | 11 | wait( 1.0 /784.0 /2.0 ); |
kohacraft | 0:c0b6adb7c5e8 | 12 | myled = 0; |
kohacraft | 0:c0b6adb7c5e8 | 13 | wait( 1.0 /784.0 /2.0 ); |
kohacraft | 0:c0b6adb7c5e8 | 14 | } |
kohacraft | 0:c0b6adb7c5e8 | 15 | for( int i = 0 ; i<180 ; i++ ) |
kohacraft | 0:c0b6adb7c5e8 | 16 | { |
kohacraft | 0:c0b6adb7c5e8 | 17 | myled = 1; |
kohacraft | 0:c0b6adb7c5e8 | 18 | wait( 1.0 /698.5 /2.0 ); |
kohacraft | 0:c0b6adb7c5e8 | 19 | myled = 0; |
kohacraft | 0:c0b6adb7c5e8 | 20 | wait( 1.0 /698.5 /2.0 ); |
kohacraft | 0:c0b6adb7c5e8 | 21 | } |
kohacraft | 0:c0b6adb7c5e8 | 22 | for( int i = 0 ; i<200 ; i++ ) |
kohacraft | 0:c0b6adb7c5e8 | 23 | { |
kohacraft | 0:c0b6adb7c5e8 | 24 | myled = 1; |
kohacraft | 0:c0b6adb7c5e8 | 25 | wait( 1.0 /784.0 /2.0 ); |
kohacraft | 0:c0b6adb7c5e8 | 26 | myled = 0; |
kohacraft | 0:c0b6adb7c5e8 | 27 | wait( 1.0 /784.0 /2.0 ); |
kohacraft | 0:c0b6adb7c5e8 | 28 | } |
kohacraft | 0:c0b6adb7c5e8 | 29 | wait(0.2); |
kohacraft | 0:c0b6adb7c5e8 | 30 | if( sw == 1 ) |
kohacraft | 0:c0b6adb7c5e8 | 31 | { |
kohacraft | 0:c0b6adb7c5e8 | 32 | wait( 5 ); |
kohacraft | 0:c0b6adb7c5e8 | 33 | } |
kohacraft | 0:c0b6adb7c5e8 | 34 | } |
kohacraft | 0:c0b6adb7c5e8 | 35 | } |