![](/media/cache/profiles/1be11c5070263813a6c631ecdba885ef.jpg.50x50_q85.png)
Cambio de pin de entrada digital a PA10
Dependencies: BufferedSerial PinDetect mbed
Fork of DTK-MEGAPACA_NUCLEO by
Diff: main.cpp
- Revision:
- 13:e3a1657843c0
- Parent:
- 12:35db44c28845
- Child:
- 14:249826741896
--- a/main.cpp Fri Mar 02 12:56:05 2018 -0600 +++ b/main.cpp Fri Mar 23 02:09:31 2018 -0600 @@ -14,13 +14,15 @@ #include "BufferedSerial.h" #include "constantes.hpp" #include "funciones_basicas.h" +#include "PinDetect.h" + +#define APAGAR_PULSOS 2 /* CONFIGURACIÓN DE HARDWARE ************************************** */ BufferedSerial gv300(USBTX, USBRX); -//Serial pcusb(USBTX, USBRX); -InterruptIn input(PC_13); //PA_9 -DigitalOut myled(PA_5); //PB_3 +PinDetect input(PA_9); //PC_13 +DigitalOut myled(LED1); // DECLARACIÓN DE VARIABLES //************************************** @@ -36,12 +38,17 @@ // DECLARACIÓN DE TEMPORIZADORES //************************************** -Timer funcionando; // Temporizador para generar el motivo por tiempo de lectura de la tarjeta NUCLEO +Timer funcionando; // Temporizador para generar el motivo por tiempo de lectura de la tarjeta NUCLEO Timer apagando_cp; // Temporizador para consultar el estatus de la puerta. +Ticker ticker_titilar; // Ticker para hacer blick de LED1 +// Funciones de Ticker +void titilar_led() { + myled = !myled; +} -void pressed_f() -{ +// Funciones de Interrupción +void flanco_negativo_SKT300N() { contador_pulsos++; } @@ -51,12 +58,14 @@ gv300.baud(115200); //pcusb.baud(115200); input.mode(PullUp); - input.fall(&pressed_f); + input.attach_asserted(&flanco_negativo_SKT300N); + input.setSampleFrequency(50000); wait(1.0); iniciando(&gv300); // Inicio de temporizadores y RTC funcionando.start(); + //ticker_titilar.attach(&titilar_led, 1.0); while(1) { //myled = !myled;