Raziel Lopez
/
frdm_K64_ON_OFFsw
ON OFF LED
main.cpp@0:100c914c126b, 2018-05-26 (annotated)
- Committer:
- RazielLopez
- Date:
- Sat May 26 14:51:59 2018 +0000
- Revision:
- 0:100c914c126b
estable
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RazielLopez | 0:100c914c126b | 1 | #include "mbed.h" |
RazielLopez | 0:100c914c126b | 2 | #include "Led_Colores.h" |
RazielLopez | 0:100c914c126b | 3 | |
RazielLopez | 0:100c914c126b | 4 | DigitalIn sw3(SW3); //Declaramos switch 2 |
RazielLopez | 0:100c914c126b | 5 | DigitalIn sw2(SW2); //Declaramos switch3 |
RazielLopez | 0:100c914c126b | 6 | |
RazielLopez | 0:100c914c126b | 7 | int main() |
RazielLopez | 0:100c914c126b | 8 | { |
RazielLopez | 0:100c914c126b | 9 | ColorLed(BLACK); |
RazielLopez | 0:100c914c126b | 10 | int bandera=0; |
RazielLopez | 0:100c914c126b | 11 | while (true) { |
RazielLopez | 0:100c914c126b | 12 | if(!sw2 && sw3){ //sw2 se niega porque al apretarlo regresa un 0 |
RazielLopez | 0:100c914c126b | 13 | ColorLed(RED); //Prende LED rojo |
RazielLopez | 0:100c914c126b | 14 | } |
RazielLopez | 0:100c914c126b | 15 | else if(!sw3 && sw2){ //sw3 se niega porque al apretarlo regresa un 0 |
RazielLopez | 0:100c914c126b | 16 | ColorLed(BLACK); //Prende LED Azul |
RazielLopez | 0:100c914c126b | 17 | wait(1.0f); |
RazielLopez | 0:100c914c126b | 18 | ColorLed(GREEN); |
RazielLopez | 0:100c914c126b | 19 | } |
RazielLopez | 0:100c914c126b | 20 | |
RazielLopez | 0:100c914c126b | 21 | |
RazielLopez | 0:100c914c126b | 22 | wait(0.2f); |
RazielLopez | 0:100c914c126b | 23 | } |
RazielLopez | 0:100c914c126b | 24 | } |