Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SerialPassthrough by
main.cpp
00001 #include "mbed.h" 00002 00003 RawSerial pc(USBTX, USBRX); 00004 00005 //RawSerial dev(D1, D0); 00006 RawSerial dev(A0, A1); 00007 00008 DigitalOut led1(LED1); 00009 DigitalOut led4(LED4); 00010 00011 void dev_recv() { 00012 led1 = !led1; 00013 while(dev.readable()) { 00014 pc.putc(dev.getc()); 00015 } 00016 } 00017 00018 void pc_recv() { 00019 led4 = !led4; 00020 while(pc.readable()) { 00021 dev.putc(pc.getc()); 00022 } 00023 } 00024 00025 int main() { 00026 #define BAUT 115200 00027 //#define BAUT 74880 00028 //#define BAUT 9600 00029 00030 pc.baud(BAUT); 00031 dev.baud(BAUT); 00032 00033 pc.printf("Start...\r\n"); 00034 00035 pc.attach(&pc_recv, Serial::RxIrq); 00036 dev.attach(&dev_recv, Serial::RxIrq); 00037 00038 while(1) { 00039 sleep(); 00040 } 00041 }
Generated on Mon Aug 1 2022 11:22:36 by
1.7.2
