ON OFF LED

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 "Led_Colores.h"
00003 
00004 DigitalIn sw3(SW3);         //Declaramos switch 2
00005 DigitalIn sw2(SW2);         //Declaramos switch3
00006 
00007 int main()
00008 {
00009     ColorLed(BLACK);
00010     int bandera=0;
00011     while (true) {
00012         if(!sw2 && sw3){               //sw2 se niega porque al apretarlo regresa un 0
00013             ColorLed(RED);              //Prende LED rojo 
00014         }
00015         else if(!sw3 && sw2){               //sw3 se niega porque al apretarlo regresa un 0
00016                        ColorLed(BLACK);      //Prende LED Azul 
00017                        wait(1.0f);
00018                        ColorLed(GREEN);
00019         }
00020         
00021            
00022         wait(0.2f);
00023     }
00024 }