Abdur Rehman Khalil
/
bt
bluetooth link
Revision 0:ecf84ddda5e9, committed 2016-01-02
- Comitter:
- ARK4579
- Date:
- Sat Jan 02 11:37:44 2016 +0000
- Commit message:
- blutooth control
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 |
diff -r 000000000000 -r ecf84ddda5e9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jan 02 11:37:44 2016 +0000 @@ -0,0 +1,59 @@ +#include "mbed.h" + +//bluetooth module employs Serial Communication. +Serial blutooth(PA_9, PA_10);//Tx, Rx +Serial pc(SERIAL_TX, SERIAL_RX); + +DigitalOut myled(LED1); //LED on your Nucleo Board +DigitalIn btn1(PC_13); //Button on your Nucleo Board + +int main() +{ + char t1,t2,h1,h2; + int it1,it2,ih1,ih2; + int it,ih; + //This will print Hello World onto your SmartPhone + blutooth.printf("Hello World !\r\n"); + while(1) { + if(blutooth.readable()) { + if(blutooth.getc()=='t') { + blutooth.printf("Enter temp: "); + while(1) { + if(blutooth.readable()) { + t1=blutooth.getc(); + it1 = t1 - '0'; + break; + } + } + while(1) { + if(blutooth.readable()) { + t2=blutooth.getc(); + it2 = t2 - '0'; + break; + } + } + it = it1*10 + it2; + pc.printf("temp: %d\r\n",it); + } + } + if(blutooth.getc()=='h') { + blutooth.printf("Enter temp: "); + while(1) { + if(blutooth.readable()) { + h1=blutooth.getc(); + ih1 = h1 - '0'; + break; + } + } + while(1) { + if(blutooth.readable()) { + h2=blutooth.getc(); + ih2 = h2 - '0'; + break; + } + } + ih = ih1*10 + ih2; + pc.printf("hum: %d\r\n",ih); + } + } +} \ No newline at end of file
diff -r 000000000000 -r ecf84ddda5e9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jan 02 11:37:44 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c \ No newline at end of file