codigo para los grupos MA MB MC de la UPPuebla 2017
Fork of Bluetooth_HC-06 by
Revision 1:7768afcb5df1, committed 2017-03-15
- Comitter:
- icmembed
- Date:
- Wed Mar 15 19:34:12 2017 +0000
- Parent:
- 0:feba469f2cf1
- Commit message:
- codigo para la clase de programacion
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r feba469f2cf1 -r 7768afcb5df1 main.cpp --- a/main.cpp Tue Nov 05 00:44:19 2013 +0000 +++ b/main.cpp Wed Mar 15 19:34:12 2017 +0000 @@ -2,16 +2,120 @@ // Use pins (RXD - PTC4, TXD - PTC3) on FRDM-KL25Z // Use both USBs to power the HC-06 (J9_12 - GND, J9_10 - 5V usb(VCC)) #include "mbed.h" - -Serial HC06(PTC4,PTC3); + int n; +Serial OSKAR(PTC4,PTC3); + void delay (int n); +DigitalOut myled(PTB18); +DigitalOut myled2(PTB19); +DigitalOut myled3(PTD1); +DigitalOut m1(PTA1); +DigitalOut m2(PTA2); +DigitalOut md1(PTA4); +DigitalOut md2(PTA5); + int main() { - HC06.baud(9600); - HC06.printf("Press 'r'\n"); + myled = 1; + myled2 = 1; + myled3 = 1; + m1 = 1; + m2 = 1; + md1 = 0; + md2 = 1; + + OSKAR.baud(9600); + delay(1000); + //OSKAR.printf("Press 'A'\n"); + while (1) { - char c = HC06.getc(); - if(c == 'r') { - HC06.printf("Hello World\n"); + char c = OSKAR.getc(); + if(c == 'A') { + OSKAR.printf("Led \n"); + myled = 1; + myled2 = 0; + myled3 = 1; + m1 = 0; + m2 = 0; + delay(1000); + + } + + if(c == 'B') { + OSKAR.printf("Led \n"); + myled = 0; + myled2 = 1; + myled3 = 0; + m1 = 0; + m2 = 0; + + delay(1000); } + + if(c == 'D') { + OSKAR.printf("LED Azul green\n"); + + myled = 0; + myled2 = 0; + myled3 = 1; + + delay(1000); + + + + + + +} + + + + + + + + + + + if(c == 'H') { + // myled3 = 1; + OSKAR.printf("LED RGB Blanco\n"); + myled = 0; + myled2 = 0; + myled3 = 0; + + delay(1000); + + } + + + if(c == 'Z') { + OSKAR.printf("LED's Apagados\n"); + + myled = 1; + myled2 = 1; + myled3 = 1; + m1 = 1; + m2 = 1; + md1 = 1; + md2 = 1; + delay(1000); + } + + + else if(c=='x'){ + myled = 1; + myled2 = 1; + myled3 = 1;} + } -} \ No newline at end of file +} + +void delay (int n) { + int i; + int j; + for(i=0;i<n;i++) + for(j=0;j<7000;j++){} + } + + + \ No newline at end of file