Gerardo CR
/
TV_bluetooth-Rx-avanzado
Bluetooth avanzado
Revision 0:1a819403fbb3, committed 2014-09-23
- Comitter:
- gerardo_carmona
- Date:
- Tue Sep 23 21:03:10 2014 +0000
- Commit message:
- Bluetooth avanzado
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 1a819403fbb3 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 23 21:03:10 2014 +0000 @@ -0,0 +1,41 @@ +/* + -- TV_bluetooth-Rx-simple -- + Example using a Bluetooth module. In this case + we use the HC-06 model. + + Pairing code: 1234 + Baud rate: 9600 + + + +*/ + + +#include "mbed.h" + +DigitalOut myled(LED_GREEN); +Serial pc(USBTX, USBRX); +Serial bt(PTE0, PTE1); + + +int main(){ + int i = 0; + pc.printf("Hello World!\n"); + myled = 1; + + while (true) { + wait(0.5f); // wait a small period of time + pc.printf("%d \n", i); // print the value of variable i + bt.printf("%d \n", i); // print the value of variable i + i++; // increment the variable + + if (bt.readable()){ + char c = bt.getc(); + if (c == 'H' || c == 'h'){ + myled = 0; + }else if (c == 'L' || 'l'){ + myled = 1; + } + } + } +}
diff -r 000000000000 -r 1a819403fbb3 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 23 21:03:10 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file