thirawat chuthong / Mbed 2 deprecated pro_function

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 PwmOut mypwm(PWM_OUT);
00004 
00005 DigitalOut myled(LED1);
00006 
00007 void check_end(){
00008     int sub_end = 0;
00009     for(int i=0;i<=16;i++){
00010         if(ship_underATK[i]!=0){
00011             sub_end++;
00012             }
00013         if(sub_end==15){
00014             bt.putc('q');
00015             }
00016         }
00017 }
00018 
00019 void check_waiting_start(){
00020     if(bt.readable()){
00021         if(bt.getc()=='W'){
00022             check_wait = 1;
00023             pc.printf("joe");
00024             }
00025         }
00026     }
00027 
00028 int main() {
00029     
00030     mypwm.period_ms(10);
00031     mypwm.pulsewidth_ms(1);
00032   
00033     printf("pwm set to %.2f %%\n", mypwm.read() * 100);
00034     
00035     while(1) {
00036         myled = !myled;
00037         wait(1);
00038     }
00039 }