HackHeld icon indicating copy to clipboard operation
HackHeld copied to clipboard

Using the left and right buttons?

Open LZ2DMV opened this issue 4 years ago • 2 comments

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.

LZ2DMV avatar Sep 20 '21 19:09 LZ2DMV

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 :)

WiFiFucker avatar Nov 07 '21 06:11 WiFiFucker

Yes, i see.

It is probably a good idea for @spacehuhn to correct that in the PCB design.

LZ2DMV avatar Nov 07 '21 11:11 LZ2DMV