Robotec 1.0.0
Button.h
1/* -- Button --
2 * Parte de la biblioteca "Robotec"
3 * created 20 Dic 2023
4 * by Lucas Martin Treser
5*/
6
7#ifndef Button_h
8#define Button_h
9
10#include "Arduino.h"
11
12/*** Constantes Globales Button ***/
13static const uint8_t PULL_UP = 0;
14static const uint8_t PULL_UP_INTERNAL = 2;
15static const uint8_t PULL_DOWN = 3;
16
17/*** Pulsador ***/
18class Button {
19 public:
20 Button(uint8_t buttonPin, uint8_t buttonMode);
21 bool push();
22 void pushStart(uint16_t time);
23 void pushStart(void (*callback)());
24
25 private:
26 uint8_t _buttonPin;
27 uint8_t _buttonMode;
28 uint8_t _buttonState;
29 uint8_t _buttonLastState;
30 uint32_t _timeLast;
31 static const uint32_t _TIME_DEBOUNCE = 50; // Ajustar este valor segĂșn sea necesario
32};
33
34#endif
Definition: Button.h:18
Button(uint8_t buttonPin, uint8_t buttonMode)
Pulsador (pushbutton)
Definition: Button.cpp:15
void pushStart(uint16_t time)
Lee el estado de un Pulsador y genera una demora bloqueante (delay) segun el tiempo especificado por ...
Definition: Button.cpp:55
bool push()
Lee el estado de un boton.
Definition: Button.cpp:33