Xinyuan-LilyGO / LilyGo-EPD47

GNU General Public License v3.0
379 stars 119 forks source link

Buttons #49

Closed otosan-maker closed 1 year ago

otosan-maker commented 3 years ago

Hello, I have tried the test program to use the buttons, IO34 and IO39 works, but IO35 is not. Is there any special thing with IO35?? I think the other button has problems ... IO0, isn´t it?

martinberlin commented 2 years ago

I tried all buttons using this repository and they work great for me https://github.com/atomic14/diy-esp32-epub-reader Maybe share some code of how you are reading them because all button GPIOs are working alright for me when trying that ePub reader.

rolohaun commented 2 years ago

Here is an easy to use example

include "Button2.h"

include

define BUTTON_1 34

define BUTTON_2 35

define BUTTON_3 39

Button2 btn1(BUTTON_1); Button2 btn2(BUTTON_2); Button2 btn3(BUTTON_3);

void buttonPressed1(Button2 &b) { Serial.println("1"); }

void buttonPressed2(Button2 &b) { Serial.println("2"); }

void buttonPressed3(Button2 &b) { Serial.println("3"); }

void setup() { Serial.begin(115200); delay(50); Serial.println("Button Demo"); btn1.setPressedHandler(buttonPressed1); btn2.setPressedHandler(buttonPressed2); btn3.setPressedHandler(buttonPressed3); }

void loop() { btn1.loop(); btn2.loop(); btn3.loop(); }