Bluetooth HC-06 Hello world
Hello,
I got this Bluetooth from ebay. It is cheap and easy to config. You will need to connect the second USB for power. I used a phone charger to power the board ( FRDM-KL25Z ).
Config your Bluetooth with your computer first.
check the following links for help http://projectsfromtech.blogspot.com/2013/06/arduino-bluetooth-with-hc-06-and-jy-mcu.html https://mbed.org/users/edodm85/notebook/HC-05-bluetooth/
main.cpp@0:feba469f2cf1, 2013-11-05 (annotated)
- Committer:
- beohad
- Date:
- Tue Nov 05 00:44:19 2013 +0000
- Revision:
- 0:feba469f2cf1
Bluetooth HC-06 V1.0; ; Use serial communication pins PTC4 PTC3 on FRDM-KL25Z
Who changed what in which revision?
User | Revision | Line number | New 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/) |
beohad | 0:feba469f2cf1 | 2 | // Use pins (RXD - PTC4, 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 | |
beohad | 0:feba469f2cf1 | 6 | Serial HC06(PTC4,PTC3); |
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 | } |