codigo para los grupos MA MB MC de la UPPuebla 2017

Dependencies:   mbed

Fork of Bluetooth_HC-06 by Ohad BarSimanTov

main.cpp

Committer:
icmembed
Date:
2017-03-15
Revision:
1:7768afcb5df1
Parent:
0:feba469f2cf1

File content as of revision 1:7768afcb5df1:

// Bluetooth HC-06 may work for HC-05 (I didn't try - check https://mbed.org/users/edodm85/notebook/HC-05-bluetooth/) 
// 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"
 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() {
         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 = 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;}
        
    }
}

void delay (int n) {
    int i;
    int j;
    for(i=0;i<n;i++)
    for(j=0;j<7000;j++){}
    }