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@0:1b2cc5f10340, 2013-10-24 (annotated)
- Committer:
- gcarmonar
- Date:
- Thu Oct 24 20:08:14 2013 +0000
- Revision:
- 0:1b2cc5f10340
- Child:
- 1:4011df68bd01
Ayuda 1 para el segundo parcial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gcarmonar | 0:1b2cc5f10340 | 1 | #include "mbed.h" |
gcarmonar | 0:1b2cc5f10340 | 2 | |
gcarmonar | 0:1b2cc5f10340 | 3 | DigitalOut led1(LED1); |
gcarmonar | 0:1b2cc5f10340 | 4 | DigitalOut led2(LED2); |
gcarmonar | 0:1b2cc5f10340 | 5 | |
gcarmonar | 0:1b2cc5f10340 | 6 | int reps = 100; //modifica este valor para hacer la secuencia mas rapida o lenta |
gcarmonar | 0:1b2cc5f10340 | 7 | |
gcarmonar | 0:1b2cc5f10340 | 8 | int main() { |
gcarmonar | 0:1b2cc5f10340 | 9 | while(1) { |
gcarmonar | 0:1b2cc5f10340 | 10 | led1 = 0; //enciendo led azul |
gcarmonar | 0:1b2cc5f10340 | 11 | while(count < reps){ //equivalente a un wait de aprox 100 ms porque hago 100 veces pausa de 1 ms |
gcarmonar | 0:1b2cc5f10340 | 12 | wait(0.001); |
gcarmonar | 0:1b2cc5f10340 | 13 | } |
gcarmonar | 0:1b2cc5f10340 | 14 | led1 = 1; //apago led1 |
gcarmonar | 0:1b2cc5f10340 | 15 | led2 = 0; //enciendo led2 |
gcarmonar | 0:1b2cc5f10340 | 16 | while(count < reps){ //equivalente a un wait de aprox 100 ms |
gcarmonar | 0:1b2cc5f10340 | 17 | wait(0.001); |
gcarmonar | 0:1b2cc5f10340 | 18 | } |
gcarmonar | 0:1b2cc5f10340 | 19 | led2 = 1; //apago led2 |
gcarmonar | 0:1b2cc5f10340 | 20 | } |
gcarmonar | 0:1b2cc5f10340 | 21 | } |