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

Tufty2040 C++ drawing example buttons created with wrong polarity #505

Closed
Footleg opened this issue Sep 1, 2022 · 1 comment
Closed
Labels
[- tufty2040 -] https://shop.pimoroni.com/products/tufty-2040 bug Something isn't working

Comments

@Footleg
Copy link

Footleg commented Sep 1, 2022

I found the buttons on the Tufty2040 badge did not work in my code based on the drawing example code. I tried copying from other examples which used the buttons on other boards with

    if(button_a.read()) {
        //Do stuff
    }

But neither this, or trying to read button_a.raw() appeared to ever return true. A hint from Phil in a Twitter reply enabled me to work out how to change the button definitions in the example so that they work. I've tested with all 5 buttons. If you define the buttons as follows with the Polarity High then the button.read() call returns true when the button is pressed:

Button button_a(Tufty2040::A,Polarity::ACTIVE_HIGH);
Button button_b(Tufty2040::B,Polarity::ACTIVE_HIGH);
Button button_c(Tufty2040::C,Polarity::ACTIVE_HIGH);
Button button_up(Tufty2040::UP,Polarity::ACTIVE_HIGH);
Button button_down(Tufty2040::DOWN,Polarity::ACTIVE_HIGH);

Suggesting this is updated in the example for tutfy2040

@ZodiusInfuser ZodiusInfuser added bug Something isn't working [- tufty2040 -] https://shop.pimoroni.com/products/tufty-2040 labels Jan 20, 2023
@kitgore
Copy link

kitgore commented Apr 13, 2023

Can this please be added, took me so long to figure this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[- tufty2040 -] https://shop.pimoroni.com/products/tufty-2040 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants