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.
Diff: main.cpp
- Revision:
- 25:ec72507ea71b
- Parent:
- 24:7f14b70fc9ef
- Child:
- 26:22f3f938cd2f
diff -r 7f14b70fc9ef -r ec72507ea71b main.cpp
--- a/main.cpp Mon Apr 08 11:03:25 2019 +0100
+++ b/main.cpp Sun Apr 12 03:56:57 2020 +0000
@@ -1,12 +1,46 @@
-#include "mbed.h"
+#include "mbed.h" //librería que nos permite utilizar comandos y sentencias propias de mbed
+
+DigitalOut alto(LED1);
+DigitalOut prev(LED2);
+DigitalOut siga(LED3);
-DigitalOut myled(LED1);
+void luz_alto() {
+ alto = 1;
+ prev = 0;
+ siga = 0;
+ wait(5);
+}
-int main() {
- while(1) {
- myled = 1;
- wait(0.2);
- myled = 0;
+void luz_preventivo() {
+ alto = 0;
+ prev = 1;
+ siga = 0;
+ wait(1);
+}
+
+void luz_siga() {
+ alto = 0;
+ prev = 0;
+ siga = 1;
+ wait(3);
+}
+
+void parpadear_luz(DigitalOut luz) {
+ for(int i=0; i<4; i++) {
+ luz = 1;
wait(0.2);
}
}
+
+int main() {
+
+ while(true)
+ {
+ luz_alto();
+ parpadear_luz(alto);
+ luz_preventivo();
+ luz_siga();
+ parpadear_luz(siga);
+ }
+
+}
\ No newline at end of file