Button library for ESP32 created to build a simple object related to a push button. This library avoid to know how to create the logic to get the button working. Instead, it allows to define a simple code to set the button code.
- Download the code
- Add the folder under
Arduino/libraries - Restart Arduino IDE
Public functions:
-
Button(int pin)Contructor, inform the
pinto set up anINPUT_PULLUPbutton -
void isPressed()Return
trueif the button is pressed.
#include <Led.h> // https://github.com/meirarc/Led.git
#include <Button.h> // https://github.com/meirarc/Button.git
Led led_built_in(LED_BUILTIN);
Button buttom(0);
void setup() {
}
void loop() {
if(buttom.isPressed()) led_built_in.on();
else led_built_in.off();
}Contributions are welcome! Feel free to open an issue or submit a pull request if you have a way to improve this project.
Make sure your request is meaningful and you have tested the app locally before submitting a pull request.
π If you like this project, give it a β and share it with friends!