BRANDON GARCIA / Mbed OS Bluetooth_LED_Test

Dependencies:   TextLCD

Revision:
0:3802a6cf8d31
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 17 17:03:31 2020 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+Serial bluetooth(PB_6, PB_3);//Pins used for communicating
+DigitalOut led(LED1);//LED1 is pin PA_5 or D13 / LED integrated in nucleoboard
+
+int main()
+{
+    lcd.cls();
+    bluetooth.baud(9600);//Default rate is 9600 bps
+    bluetooth.printf("If '1' is sent then turn on LED1 , if '0' turn it off\n");
+    while(1) {
+        char c = bluetooth.getc(); // To read the data sent thorugh the bluetooth module
+            if (c == '0') {// If value equals '0' 
+                led = 0; // Turn OFF LED1
+        }
+        if (c == '1') {// If value equals '1' 
+                led = 1; // Turn ON LED1      
+        }
+    }
+}
+