asdasd

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tzuran
Date:
Thu Mar 28 15:28:39 2019 +0000
Commit message:
puto el que lee

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r d17d3e96e274 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 28 15:28:39 2019 +0000
@@ -0,0 +1,72 @@
+#include "mbed.h"
+
+Ticker tick;
+DigitalOut led1(LED_RED);
+DigitalOut led2(LED_GREEN);
+DigitalOut led3(LED_BLUE);
+
+int tiempo = 0;
+
+void leds();
+
+void seg5()
+{
+    tiempo = 1;
+}
+
+int main()
+{
+    tick.attach(&seg5, 5); // setup ticker to call flip every 5 seconds
+
+    while (true) {
+        leds();
+    }
+}
+
+void leds()
+{
+    static int estado = 0;
+    switch(estado) {
+        case 0:
+            led1 = 1;
+            led2 = 1;
+            led3 = 1;
+
+            if(tiempo == 1) {
+                tiempo = 0;
+                estado++;
+            }
+        break;
+        case 1:
+            led1 = 0;
+            led2 = 1;
+            led3 = 1;
+
+            if(tiempo == 1) {
+                tiempo = 0;
+                estado++;
+            }
+        break;
+        case 2:
+            led1 = 1;
+            led2 = 0;
+            led3 = 0;
+
+            if(tiempo == 1) {
+                tiempo = 0;
+                estado++;
+            }
+        break;
+        case 3:
+            led1 = 0;
+            led2 = 0;
+            led3 = 1;
+
+            if(tiempo == 1) {
+                tiempo = 0;
+                estado = 0;
+            }
+        break;   
+    }
+
+}
\ No newline at end of file
diff -r 000000000000 -r d17d3e96e274 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 28 15:28:39 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file