mbed_bot

Dependencies:   mbed

Revision:
0:d44946656cbe
Child:
1:dfc4375f3eb5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Feb 25 13:22:04 2021 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+Serial blue(p9, p10);          // TX, RX
+
+DigitalOut myled(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled4(LED4);
+
+
+int main() 
+{
+
+    blue.baud(9600);
+    pc.baud(115200);
+    pc.printf("Bluetooth Start\r\n");
+    blue.printf("Bluetooth Start\r\n");
+    
+    // echo back characters and toggle the LED
+    while (1) 
+    {
+        myled2 = !myled2;
+        if (blue.readable()) 
+        {
+            pc.putc(blue.getc());
+            myled = !myled;
+        }
+        if (pc.readable()) 
+        {
+            blue.putc(pc.getc());
+            myled4 = !myled4;
+        }
+        
+    }
+}