button icon indicating copy to clipboard operation
button copied to clipboard

Pullup

Open yentzee opened this issue 2 years ago • 1 comments

Hi, sorry my programming skills are close to zero. I was wondering what would be the right way to setup the internal pullup resistors when using the library. thanks for helping

yentzee avatar Dec 18 '22 19:12 yentzee

A bit late, so you probably found a solution of moved on, but here is my best attempt at explaning this anyway.

You don't need to set up the internal pullup resistors, ezButton does that for you by default.

If you look in the ezButton code in the file ezButton.cpp, you can see this on line 34 ezButton::ezButton(int pin): ezButton(pin, INPUT_PULLUP) {}; This means the constructor ezButton(int pin) will call the second constructor ezButton(pin, INPUT_PULLUP).

What this means is when you e.g. put this in your code:

 #define MY_BUTTON_PIN 3
 ezButton myButton(MY_BUTTON_PIN)

The ezButton library will create a new instance of the ezButton class with this constructor: ezButton(3, INPUT_PULLUP).

bertenvdb avatar Apr 20 '23 08:04 bertenvdb

We just released new version 1.0.5 that supports internal pull-up/pull-down, external pull-up/pull-down.

Note:

  • Some Arduino boards do not support INTERNAL_PULLDOWN
  • ESP32 board: Pins GPIO34, GPIO35, GPIO36(VP) and GPIO39(VN) does not support INTERNAL_PULLDOWN and INTERNAL_PULLUP.
  • It is good to read boards manual to check if a pin support INTERNAL_PULLDOWN and INTERNAL_PULLUP.

ArduinoGetStarted avatar Aug 09 '24 01:08 ArduinoGetStarted