Bletooth
Dependencies: mbed
Revision 0:1f7823a82513, committed 2017-02-09
- Comitter:
- DonatoSt
- Date:
- Thu Feb 09 14:36:24 2017 +0000
- Commit message:
- Bluetooth
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 1f7823a82513 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 09 14:36:24 2017 +0000 @@ -0,0 +1,68 @@ +#include "mbed.h" +Serial bt(D10,D2); //RX TX +Serial pc(USBTX, USBRX); +DigitalOut dcm01(D6); +DigitalOut dcm02(D7); +DigitalOut dcm03(D4); +DigitalOut dcm04(D5); +char x; + + + + +int main() +{ + + bt.baud(9600); + + while(1) { + if (bt.readable()) { + x= bt.putc(bt.getc()); + + + if ( x == 'a') { + + dcm01 = 1; + dcm02 = 0; + dcm03 = 1; + dcm04 = 0; + + } + + if (x == 'b') { + + dcm01 = 0; + dcm02 = 1; + dcm03 = 0; + dcm04 = 1; + + } + + if (x== 'c') { + + dcm01 = 1; + dcm02 = 0; + dcm03 = 0; + dcm04 = 1; + } + if (x== 'd') { + + dcm01 = 0; + dcm02 = 1; + dcm03 = 1; + dcm04 = 0; + } + if (x== 'e') { + + dcm01 = 0; + dcm02 = 0; + dcm03 = 0; + dcm04 = 0; + } + + + }//chiusa if (bt.readable()) + + }//Chiusa while +}//Chiusa main +
diff -r 000000000000 -r 1f7823a82513 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Feb 09 14:36:24 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf \ No newline at end of file