Communicate between HC05 Bluetooth and PC

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mrbhatter
Date:
Sun Jul 01 07:21:40 2018 +0000
Commit message:
SerialToBT

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jul 01 07:21:40 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file