This examples shows how to use two push buttons to set the frequency at which an LED blinks.
The internal pull-up resistors will be enabled.
const unsigned long maxInterval = 2000;
const unsigned long minInterval = 100;
const unsigned long defaultInterval = 500;
const int intervalDelta = 100;
void setup() {
buttons.begin();
Serial.begin(115200);
}
void loop() {
if (timer)
switch (buttons.update()) {
break;
break;
break;
default: break;
}
}
constexpr PinStatus_t LOW
constexpr PinStatus_t HIGH
constexpr PinMode_t OUTPUT
Dummy header file for Arduino builder.
A class for easily managing timed events.
unsigned long getInterval() const
Get the interval of the timer.
void setInterval(unsigned long interval)
Set the interval of the timer.
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
PinStatus_t digitalRead(pin_t pin)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
constexpr auto min(const T &a, const U &b) -> decltype(b< a ? b :a)
Return the smaller of two numbers/objects.
constexpr auto max(const T &a, const U &b) -> decltype(a< b ? b :a)
Return the larger of two numbers/objects.