Communicate between HC05 Bluetooth and PC
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:d064762c393c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jul 01 07:21:40 2018 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); +Serial uart(PTE0, PTE1); + +DigitalOut pc_activity(LED1); +DigitalOut uart_activity(LED2); + +int main() { + uart.baud(9600); + while(1) { + if(pc.readable()) { + uart.putc(pc.getc()); + pc_activity = !pc_activity; + } + if(uart.readable()) { + pc.putc(uart.getc()); + uart_activity = !uart_activity; + } + } +} \ No newline at end of file