#include <Arduino.h>
class ButtonLED {
private:
uint8_t button, led;
public:
ButtonLED(uint8_t button, uint8_t led) : button(button), led(led) {
pinMode(led, OUTPUT);
pinMode(button, INPUT);
}
void operator()() {
static bool last = false;
const bool button = digitalRead(this->button);
if (last && !button)
digitalWrite(this->led, !digitalRead(this->led));
last = button;
delay(20);
}
};
ButtonLED buttonLED(0, 1);
void setup() {
}
void loop() {
buttonLED();
}
-
Notifications
You must be signed in to change notification settings - Fork 0
NANOmatic/Adrian
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published