test_code / Mbed 2 deprecated nucleo_test_soft_serial

Dependencies:   mbed

Fork of nucleo_test_soft_serial by Eric Nativel

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "soft_uart.h"
00003 Serial pc(USBTX, USBRX);
00004 char tmp;
00005 int main() {
00006  
00007     pc.baud(9600);
00008     pc.printf("test");
00009     init_uart();
00010     pc.printf("cpuclock:%d",SystemCoreClock);
00011     //printStr("d\n\r");
00012     wait(1);
00013     //printStr("Voila!\n\r");
00014     //printStr("Voila!\n\r");
00015     printStr("$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");
00016     printStr("$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");
00017    // printStr("$PMTK314,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");
00018      wait(1);
00019     while(1){
00020        // printStr("V");
00021      // printStr("$PMTK314,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n");
00022         //pc.putc(  _getchar()  );
00023         do
00024     {
00025         tmp= _getchar();
00026         pc.printf("%c",tmp);
00027        
00028     }while(tmp!='\r');
00029         //wait(0.1);
00030     }
00031 }