Archit Muchhal
/
Wireless_App
Bluetooth LED Triggering using FRDM-K64F
Revision 0:938c4afdc9b9, committed 2016-12-05
- Comitter:
- architmuchhal
- Date:
- Mon Dec 05 20:33:13 2016 +0000
- Commit message:
- FRDM-K64F based LED Trigerring
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 938c4afdc9b9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 05 20:33:13 2016 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h" +#include <stdio.h> +#include <string.h> + +Serial pc(USBTX, USBRX); + +DigitalOut GREEN (LED2); //FRDM in-built LED +DigitalOut led (PTC17); //External LED from breadboard + +Serial blue(PTC15, PTC14); //HC-06 TX and RX + +int c = 0; + +int main () +{ + GREEN = 1; //FRDM LED initially OFF + led = 0; //External LED initially OFF + while(1) + { + if(blue.readable()> 0) + { + c = blue.getc(); + } + if (c == '1') + { + //LEDs in OFF State + + GREEN = 1; + led = 0; + } + else if (c == '2') + { + //LEDs in ON State + + GREEN = 0; + led = 1; + blue.printf("LED: ON"); + } + } + } + + + + \ No newline at end of file
diff -r 000000000000 -r 938c4afdc9b9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 05 20:33:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf \ No newline at end of file