:)
Dependencies: mbed
Revision 0:0edf9dcc41ca, committed 2014-09-18
- Comitter:
- DiegoVT
- Date:
- Thu Sep 18 18:24:05 2014 +0000
- Commit message:
- :) ahi esta Omi
Changed in this revision
diff -r 000000000000 -r 0edf9dcc41ca LED_COLORES/Led_Colores.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LED_COLORES/Led_Colores.cpp Thu Sep 18 18:24:05 2014 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +#include "Led_Colores.h" + +DigitalOut LedR(LED_RED) ; +DigitalOut LedB(LED_BLUE); +DigitalOut LedG(LED_GREEN); + +void Colores (int x) +{ + if ((x & BIT_RED)) { + LedR = ON; + } + else { + LedR = OFF; + } + + if ((x & BIT_GREEN)) { + LedG = ON; + } + else { + LedG = OFF; + } + + if ((x & BIT_BLUE)) { + LedB = ON; + } + else { + LedB = OFF; + } + +} + +void Apaga_Leds (void) +{ + LedR = OFF; + LedG = OFF; + LedB = OFF; +}
diff -r 000000000000 -r 0edf9dcc41ca LED_COLORES/Led_Colores.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LED_COLORES/Led_Colores.h Thu Sep 18 18:24:05 2014 +0000 @@ -0,0 +1,11 @@ +#include "mbed.h" +#define ON 0 +#define OFF 1 + +enum Bit_Color {BIT_RED=1, BIT_GREEN=2, BIT_BLUE=4}; +enum Led_Color {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE}; +void Colores (int x); +void Apaga_Leds (void); + + +
diff -r 000000000000 -r 0edf9dcc41ca main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 18 18:24:05 2014 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" +#include "Led_Colores.h" + +DigitalIn sw2(SW2); +DigitalIn sw3(SW3); + +int main() +{ + while (true) { + if(!sw2&&sw3) { + Colores(RED); + } else { + Colores(BLACK); + } + if(!sw3&&sw2) { + Colores(GREEN); + } else { + Colores(BLACK); + } + if(!sw2 && !sw3) { + Colores(BLUE); + } else { + Colores(BLACK); + } +} +} \ No newline at end of file
diff -r 000000000000 -r 0edf9dcc41ca mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 18 18:24:05 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file