Diego Rivera / Mbed 2 deprecated CerraduraBluetooth

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Cerradura.h"
00003 
00004 //DigitalOut cerradura (D2);
00005 //DigitalOut gnd(D2);
00006 //DigitalOut vcc(D3);
00007 //DigitalOut en(D4);
00008 
00009 Serial bluetooth(PTE0, PTE1);
00010 Cerradura cerradura(D2);      //clase para abrir y crrar cerradura
00011 Cerradura rojo(LED1);
00012 Cerradura verde(LED2);
00013 
00014 void leer()                     //interrupcion rx serial
00015 {
00016     int in;
00017     bluetooth.scanf("%d", &in);
00018     if(in==1)
00019     {
00020         cerradura.abrir();
00021         rojo.abrir();
00022         verde.cerrar();
00023         bluetooth.printf("1");
00024     }
00025     if(in==0)
00026     {
00027         cerradura.cerrar();
00028         rojo.cerrar();
00029         verde.abrir();
00030         bluetooth.printf("0");
00031     }
00032 }
00033 
00034 int main()
00035 {
00036 //    gnd=0;
00037 //    vcc=1;
00038 //    en=1;
00039     bluetooth.baud(9600);
00040     bluetooth.format(8, SerialBase::None, 1);
00041     bluetooth.attach(&leer, Serial::RxIrq);
00042     while(1)
00043     {
00044     }
00045 }