haopeng tang / Mbed 2 deprecated Nucleo_STM32_401RE

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 DigitalIn myBt(USER_BUTTON);
00007 Serial pc(USBTX,USBRX);
00008 int main() {
00009     
00010     //mypwm.period_ms(10);
00011     //mypwm.pulsewidth_ms(1);
00012   
00013     //printf("pwm set to %.2f %%\n", mypwm.read() * 100);
00014     pc.baud(115200);
00015     printf("hello world!");//why is cant't printf????
00016     pc.printf("PChello world!\n");
00017     while(1) {
00018         if(myBt.read()==0)
00019         {
00020              myled = !myled;
00021              printf("hello world,system had passed%dms\n",(int)us_ticker_read());
00022         }
00023         //myled = !myled;
00024         wait(0.1);
00025     }
00026 }