![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
case3
Dependencies: mbed SeeedShieldBot BluetoothSerial
Diff: main.cpp
- Revision:
- 0:38220a94a194
diff -r 000000000000 -r 38220a94a194 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Sep 15 15:07:22 2021 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" + +RawSerial pc(USBTX, USBRX); +RawSerial dev(D8, D2); +DigitalOut led1(LED1); + +void dev_recv() +{ + led1 = !led1; + while(dev.readable()) { + pc.putc(dev.getc()); + } +} + +void pc_recv() +{ + while(pc.readable()) { + dev.putc(pc.getc()); + } +} + +int main() +{ + pc.baud(115200); + dev.baud(115200); + + pc.attach(&pc_recv, Serial::RxIrq); + dev.attach(&dev_recv, Serial::RxIrq); + + while(1) { + sleep(); + } +} \ No newline at end of file