thirawat chuthong
/
pro_function
check wait start function and end function
Diff: main.cpp
- Revision:
- 0:5fde9944d50c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 03 06:53:20 2016 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" + +PwmOut mypwm(PWM_OUT); + +DigitalOut myled(LED1); + +void check_end(){ + int sub_end = 0; + for(int i=0;i<=16;i++){ + if(ship_underATK[i]!=0){ + sub_end++; + } + if(sub_end==15){ + bt.putc('q'); + } + } +} + +void check_waiting_start(){ + if(bt.readable()){ + if(bt.getc()=='W'){ + check_wait = 1; + pc.printf("joe"); + } + } + } + +int main() { + + mypwm.period_ms(10); + mypwm.pulsewidth_ms(1); + + printf("pwm set to %.2f %%\n", mypwm.read() * 100); + + while(1) { + myled = !myled; + wait(1); + } +}