This is a very basic bluetooth program which sends data (a number in this case) through bluetooth module to a PC or smart phone (simply any device which has bluetooth connectivity) and increments the number every 500 ms and writes it to the screen with the regular printf function.

Dependencies:   mbed

Revision:
0:818577562aa4
Child:
1:4e5b38982e90
diff -r 000000000000 -r 818577562aa4 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 09 07:39:16 2015 +0000
@@ -0,0 +1,40 @@
+/*  Bluetooth(HC-06) example on LPC1768 
+*
+*    @author: Baser Kandehir 
+*    @date: July 9, 2015
+*    @license: Use this code however you'd like
+*   
+*    @description of the program: 
+*    
+*    This is a very basic bluetooth program which sends data(a number in this case) 
+*    through bluetooth module to a PC or smart phone(simply any device which has 
+*    bluetooth connectivity) and increments it every 500 ms and writes it to the screen
+*    with the regular printf function.
+*
+*    @connections:
+*-------------------------------------------------------------- 
+*    |LPC1768|        |Peripherals|
+*    Pin 13 --------> (TX) RX pin of the Bluetooth module 
+*    Pin 14 --------> (RX) TX pin of the Bluetooth  module
+*    GND ----------->  GND of the Bluetooth module
+*    VOUT (3.3 V) -->  VCC of the Bluetooth module
+*---------------------------------------------------------------
+*
+*/
+
+#include "mbed.h"
+
+Serial bluetooth(p13,p14);    // p13: TX, p14: RX (LPC1768)
+int i=0;
+
+int main()
+{
+    bluetooth.baud(9600);
+    bluetooth.printf("Hello world... \r\n");
+    while(1)
+    {
+       i++;
+       bluetooth.printf("Value of the i is: %d \r\n",i);
+       wait(0.5);
+    }    
+}
\ No newline at end of file