Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.3.x breaks default implementation? #61

Open
TheBay0r opened this issue Jan 27, 2024 · 4 comments
Open

2.3.x breaks default implementation? #61

TheBay0r opened this issue Jan 27, 2024 · 4 comments
Assignees
Labels

Comments

@TheBay0r
Copy link

Hi!

Sry if the title might be confusing, but so is the issue I experience.

I have reduced my button code to the core to be able to reproduce it.
This code seems to be working fine on version 2.2.4 of the library, but doesn't recognise my button button anymore from 2.3.0 and 2.3.1

#include <Arduino.h>
#include <Button2.h>

#define BUTTON_PIN 19

Button2 button;

void setup() {
  Serial.begin(115200);
  Serial.println("Starting Setup");

  button.begin(BUTTON_PIN);

}

void loop() {
  button.loop();

  clickType buttonState = button.read();

  if (buttonState != clickType::empty) {
    Serial.println("Button State not empty");
  }
}

Because I first thought my button broke I even tried to just short PIN and GND. But I experienced the same behaviour with shorting.

Help or explanation would be highly appreciated.

@LennartHennigs
Copy link
Owner

Hey,
hm, that is strange.

If you compare the versions you'll see that I did not change that much in Button.h or Button.cpp. I do a more thorough reset of the button state in the read() function but that looks correct.
Unfortunately, I don't have time this weekend to look into this further.
I'll be a few days.

@LennartHennigs LennartHennigs self-assigned this Jan 27, 2024
@TheBay0r
Copy link
Author

Yes, I did compare the versions, which confuses me even more. Sadly it is perfectly reproducible for me. Upgrading, downgrading, uninstalling, reinstalling. 2.2.4 works, above doesn't. If there is anything I can add for debugging purposes, let me know

@jay2216
Copy link

jay2216 commented Feb 17, 2024

2.3 doesn't work for me either on an Arduino r4. I get several errors.

Button2/src/Hardware.h:59:28: error: invalid conversion from 'int' to 'PinMode' [-fpermissive]

packages/arduino/hardware/renesas_uno/1.0.5/cores/arduino/api/Common.h:96:6: note: initializing argument 2 of 'void pinMode(pin_size_t, PinMode)' void pinMode(pin_size_t pinNumber, PinMode pinMode);

Button2/src/Hardware.h:62:34: error: invalid conversion from 'int' to 'PinStatus' [-fpermissive] ::digitalWrite(pin, value);

.arduino15/packages/arduino/hardware/renesas_uno/1.0.5/cores/arduino/api/Common.h:97:6: note: initializing argument 2 of 'void digitalWrite(pin_size_t, PinStatus)' void digitalWrite(pin_size_t pinNumber, PinStatus status);

``

@LennartHennigs
Copy link
Owner

LennartHennigs commented Feb 17, 2024

@jay2216 different issue, created a new issue for it: #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants