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-24
- Revision:
- 26:22f3f938cd2f
- Parent:
- 25:ec72507ea71b
- Child:
- 27:d8f636a2a766
File content as of revision 26:22f3f938cd2f:
#include "mbed.h" //librería que nos permite utilizar comandos y sentencias propias de mbed
Serial com1(USBTX, USBRX);
DigitalOut rojo(LED1);
DigitalOut verde(LED2);
DigitalOut azul(LED3);
void luz_alto() {
rojo = 0;
verde = 1;
azul = 1;
wait(5);
}
void luz_preventivo() {
rojo = 0;
verde = 0;
azul = 1;
wait(1);
}
void luz_siga() {
rojo = 1;
verde = 0;
azul = 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(rojo);
luz_preventivo();
luz_siga();
parpadear_luz(verde);
}
}