HackHeld
HackHeld copied to clipboard
Using the left and right buttons?
Hello,
How can i use the left and right buttons on my Hackheld Vega?
According to the board print, they are on D0 and D7, which are 16 and 13 microcontroller pins respectively.
I tried adding this to the Button block in A_config.h:
#define BUTTON_LEFT 16 // D0
#define BUTTON_RIGHT 13 // D7
Then, using them in DisplayUI class:
void DisplayUI::setupButtons() {
(...)
leftBtn = new ButtonPullup(BUTTON_LEFT);
rightBtn = new ButtonPullup(BUTTON_RIGHT);
(...)
// === BUTTON LEFT === //
leftBtn->setOnClicked([this]() {
scan.stop();
});
That doesn't work, though - nothing happens on button press.
Sir GPIO16 (D0) is the one pin that is not suitable for buttons. :) It can be used as an output only and has the special role of sending a wakeup signal during deepsleep.
I find this web page handy as a reference for stuff like this: ESP8266 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials
You can add a resistor to fix this :)
Yes, i see.
It is probably a good idea for @spacehuhn to correct that in the PCB design.