check wait start function and end function

Dependencies:   mbed

Committer:
thirawat
Date:
Sat Dec 03 06:53:20 2016 +0000
Revision:
0:5fde9944d50c
project_function end

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thirawat 0:5fde9944d50c 1 #include "mbed.h"
thirawat 0:5fde9944d50c 2
thirawat 0:5fde9944d50c 3 PwmOut mypwm(PWM_OUT);
thirawat 0:5fde9944d50c 4
thirawat 0:5fde9944d50c 5 DigitalOut myled(LED1);
thirawat 0:5fde9944d50c 6
thirawat 0:5fde9944d50c 7 void check_end(){
thirawat 0:5fde9944d50c 8 int sub_end = 0;
thirawat 0:5fde9944d50c 9 for(int i=0;i<=16;i++){
thirawat 0:5fde9944d50c 10 if(ship_underATK[i]!=0){
thirawat 0:5fde9944d50c 11 sub_end++;
thirawat 0:5fde9944d50c 12 }
thirawat 0:5fde9944d50c 13 if(sub_end==15){
thirawat 0:5fde9944d50c 14 bt.putc('q');
thirawat 0:5fde9944d50c 15 }
thirawat 0:5fde9944d50c 16 }
thirawat 0:5fde9944d50c 17 }
thirawat 0:5fde9944d50c 18
thirawat 0:5fde9944d50c 19 void check_waiting_start(){
thirawat 0:5fde9944d50c 20 if(bt.readable()){
thirawat 0:5fde9944d50c 21 if(bt.getc()=='W'){
thirawat 0:5fde9944d50c 22 check_wait = 1;
thirawat 0:5fde9944d50c 23 pc.printf("joe");
thirawat 0:5fde9944d50c 24 }
thirawat 0:5fde9944d50c 25 }
thirawat 0:5fde9944d50c 26 }
thirawat 0:5fde9944d50c 27
thirawat 0:5fde9944d50c 28 int main() {
thirawat 0:5fde9944d50c 29
thirawat 0:5fde9944d50c 30 mypwm.period_ms(10);
thirawat 0:5fde9944d50c 31 mypwm.pulsewidth_ms(1);
thirawat 0:5fde9944d50c 32
thirawat 0:5fde9944d50c 33 printf("pwm set to %.2f %%\n", mypwm.read() * 100);
thirawat 0:5fde9944d50c 34
thirawat 0:5fde9944d50c 35 while(1) {
thirawat 0:5fde9944d50c 36 myled = !myled;
thirawat 0:5fde9944d50c 37 wait(1);
thirawat 0:5fde9944d50c 38 }
thirawat 0:5fde9944d50c 39 }