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.
main.cpp
- Committer:
- BaserK
- Date:
- 2015-07-09
- Revision:
- 1:4e5b38982e90
- Parent:
- 0:818577562aa4
- Child:
- 2:14757fbab275
File content as of revision 1:4e5b38982e90:
/* 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 the number 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); } }