![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
JOSE ALBERTO RUIZ, SEBASTIAN PELAEZ LENTEJA // Programa que incrementa en 10% el periodo de una señal por medio de pulsaciones, El pulsador está entre el pin PTC11 y GND / This program increases 10% the period of a square signal via keystrokes.Button is connected between pin PTC11 and GND // JOSE RUIZ, UNALMED 2014
Dependencies: DebouncedIn mbed
main.cpp@0:574647369d62, 2014-03-26 (annotated)
- Committer:
- jaruiz
- Date:
- Wed Mar 26 05:00:53 2014 +0000
- Revision:
- 0:574647369d62
Tarea 1 Procesadores, programa que incrementa en 10% el periodo de una se?al cuadrada que enciende el led por medio de pulsaciones, el pulsador est? conectado entre pines PTC11 y GND /This program increases 10% the signal period by keystrokes /UNAL
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jaruiz | 0:574647369d62 | 1 | #include "mbed.h" |
jaruiz | 0:574647369d62 | 2 | #include "stdio.h" |
jaruiz | 0:574647369d62 | 3 | #include "DebouncedIn.h" |
jaruiz | 0:574647369d62 | 4 | |
jaruiz | 0:574647369d62 | 5 | DigitalOut led(LED1); |
jaruiz | 0:574647369d62 | 6 | |
jaruiz | 0:574647369d62 | 7 | DebouncedIn pulsador(PTC11); |
jaruiz | 0:574647369d62 | 8 | |
jaruiz | 0:574647369d62 | 9 | float t; |
jaruiz | 0:574647369d62 | 10 | int main() { |
jaruiz | 0:574647369d62 | 11 | while(1) { |
jaruiz | 0:574647369d62 | 12 | led=!led; |
jaruiz | 0:574647369d62 | 13 | if (pulsador.falling()){ |
jaruiz | 0:574647369d62 | 14 | if (t+0.1<1) |
jaruiz | 0:574647369d62 | 15 | t=t+0.1; |
jaruiz | 0:574647369d62 | 16 | else |
jaruiz | 0:574647369d62 | 17 | t=0.1; |
jaruiz | 0:574647369d62 | 18 | } |
jaruiz | 0:574647369d62 | 19 | wait(t); |
jaruiz | 0:574647369d62 | 20 | } |
jaruiz | 0:574647369d62 | 21 | } |