Code to publish hello world through bluetooth

Dependencies:   mbed

Fork of Bluetooth_HC-06 by Ohad BarSimanTov

Committer:
darcy11025
Date:
Mon Dec 12 13:25:15 2016 +0000
Revision:
1:4e7a04a1553c
Parent:
0:feba469f2cf1
WORKS;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
beohad 0:feba469f2cf1 1 // Bluetooth HC-06 may work for HC-05 (I didn't try - check https://mbed.org/users/edodm85/notebook/HC-05-bluetooth/)
darcy11025 1:4e7a04a1553c 2 // Use pins (p13, TXD - PTC3) on FRDM-KL25Z
beohad 0:feba469f2cf1 3 // Use both USBs to power the HC-06 (J9_12 - GND, J9_10 - 5V usb(VCC))
beohad 0:feba469f2cf1 4 #include "mbed.h"
beohad 0:feba469f2cf1 5
darcy11025 1:4e7a04a1553c 6 Serial HC06(p13,p14);
beohad 0:feba469f2cf1 7
beohad 0:feba469f2cf1 8 int main() {
beohad 0:feba469f2cf1 9 HC06.baud(9600);
beohad 0:feba469f2cf1 10 HC06.printf("Press 'r'\n");
beohad 0:feba469f2cf1 11 while (1) {
beohad 0:feba469f2cf1 12 char c = HC06.getc();
beohad 0:feba469f2cf1 13 if(c == 'r') {
beohad 0:feba469f2cf1 14 HC06.printf("Hello World\n");
beohad 0:feba469f2cf1 15 }
beohad 0:feba469f2cf1 16 }
beohad 0:feba469f2cf1 17 }