![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This program will enable the communication between bluetooth HC-06 module and mbed Nucleo STF401RE
Revision 0:4b83964a5228, committed 2015-06-08
- Comitter:
- HemaChowdary
- Date:
- Mon Jun 08 10:10:53 2015 +0000
- Commit message:
- This program will enable the communication between bluetooth HC-06 module and mbed Nucleo STF401RE
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jun 08 10:10:53 2015 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" + +Serial bt(D10,D2); +Serial pc(USBTX,USBRX); +DigitalOut myled(D13); + +int main() +{ + bt.baud(9600); + //prints data on mobile + bt.printf("Connection Established"); + //print data on pc terminal + pc.printf("Connection Established"); + while(1) { + //For reading and writing data from/to bluetooth HC-06 + //check if bluetooth is readable and execute commands to toggle LED + if (bt.readable()) { + char input_key= bt.putc(bt.getc()); + //tutn on LED if "y" is entered + if(input_key == 'y') { + myled = 1; + bt.printf("LED is ON"); + } + //tutn on LED if "n" is entered + if(input_key == 'n') { + myled = 0; + bt.printf("LED is OFF"); + } + } + + //For reading and writing data from/to pc terminal + //check if pc is readable and execute commands to toggle LED + if (pc.readable()) { + char input_key= pc.putc(pc.getc()); + + if(input_key == 'y') { + myled = 1; + pc.printf("LED is ON"); + } + if(input_key == 'n') { + myled = 0; + pc.printf("LED is OFF"); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Jun 08 10:10:53 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file