Tarea1-Versión1. Uso de un botón para disminuir el tiempo de encendido y apagado de un LED.
Dependencies: DebouncedIn mbed
Fork of Tarea1-V1 by
main.cpp@0:a5303b7e78e3, 2014-03-28 (annotated)
- Committer:
- juniorACA
- Date:
- Fri Mar 28 21:09:22 2014 +0000
- Revision:
- 0:a5303b7e78e3
Versi?n 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
juniorACA | 0:a5303b7e78e3 | 1 | #include "mbed.h" |
juniorACA | 0:a5303b7e78e3 | 2 | #include "DebouncedIn.h" |
juniorACA | 0:a5303b7e78e3 | 3 | |
juniorACA | 0:a5303b7e78e3 | 4 | |
juniorACA | 0:a5303b7e78e3 | 5 | DebouncedIn mybutton(PTC12); |
juniorACA | 0:a5303b7e78e3 | 6 | DigitalOut myled(LED1); |
juniorACA | 0:a5303b7e78e3 | 7 | |
juniorACA | 0:a5303b7e78e3 | 8 | float delay = 0.01; |
juniorACA | 0:a5303b7e78e3 | 9 | int main() |
juniorACA | 0:a5303b7e78e3 | 10 | { |
juniorACA | 0:a5303b7e78e3 | 11 | while (1) { |
juniorACA | 0:a5303b7e78e3 | 12 | if (mybutton.falling()) |
juniorACA | 0:a5303b7e78e3 | 13 | { |
juniorACA | 0:a5303b7e78e3 | 14 | delay += 0.01; |
juniorACA | 0:a5303b7e78e3 | 15 | } |
juniorACA | 0:a5303b7e78e3 | 16 | myled = !myled; |
juniorACA | 0:a5303b7e78e3 | 17 | wait(delay); |
juniorACA | 0:a5303b7e78e3 | 18 | } |
juniorACA | 0:a5303b7e78e3 | 19 | } |