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.
main.cpp
- Committer:
- nervy
- Date:
- 2020-04-12
- Revision:
- 25:ec72507ea71b
- Parent:
- 24:7f14b70fc9ef
- Child:
- 26:22f3f938cd2f
File content as of revision 25:ec72507ea71b:
#include "mbed.h" //librería que nos permite utilizar comandos y sentencias propias de mbed
DigitalOut alto(LED1);
DigitalOut prev(LED2);
DigitalOut siga(LED3);
void luz_alto() {
alto = 1;
prev = 0;
siga = 0;
wait(5);
}
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);
}
}