Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:100c914c126b, committed 2018-05-26
- Comitter:
- RazielLopez
- Date:
- Sat May 26 14:51:59 2018 +0000
- Commit message:
- estable
Changed in this revision
diff -r 000000000000 -r 100c914c126b LED_COLORES/Led_Colores.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LED_COLORES/Led_Colores.cpp Sat May 26 14:51:59 2018 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "Led_Colores.h"
+
+DigitalOut ledR(LED_RED);
+DigitalOut ledB(LED_BLUE);
+DigitalOut ledG(LED_GREEN);
+
+void ColorLed(int c){
+
+
+ if(c & BIT_RED )
+ ledR=on;
+ else
+ ledR= off;
+ if(c & BIT_GREEN)
+ ledG=on;
+ else
+ ledG=off;
+ if(c & BIT_BLUE)
+ ledB=on;
+ else
+ ledB=off;
+}
diff -r 000000000000 -r 100c914c126b LED_COLORES/Led_Colores.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LED_COLORES/Led_Colores.h Sat May 26 14:51:59 2018 +0000
@@ -0,0 +1,12 @@
+#include "mbed.h"
+#define off 1
+#define on 0
+
+void ColorLed(int);
+
+enum Bit_Color{
+ BIT_RED=1,BIT_GREEN=2,BIT_BLUE=4
+ };
+enum Led_Color {
+ BLACK,RED,GREEN,YELLOW,BLUE,MAGENTA,CYAN,WHITE
+ };
\ No newline at end of file
diff -r 000000000000 -r 100c914c126b main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat May 26 14:51:59 2018 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include "Led_Colores.h"
+
+DigitalIn sw3(SW3); //Declaramos switch 2
+DigitalIn sw2(SW2); //Declaramos switch3
+
+int main()
+{
+ ColorLed(BLACK);
+ int bandera=0;
+ while (true) {
+ if(!sw2 && sw3){ //sw2 se niega porque al apretarlo regresa un 0
+ ColorLed(RED); //Prende LED rojo
+ }
+ else if(!sw3 && sw2){ //sw3 se niega porque al apretarlo regresa un 0
+ ColorLed(BLACK); //Prende LED Azul
+ wait(1.0f);
+ ColorLed(GREEN);
+ }
+
+
+ wait(0.2f);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 100c914c126b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat May 26 14:51:59 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file
