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

Raspberry pi4, pullup seems to be not effective. #18

Open
michalpelka opened this issue Feb 12, 2023 · 0 comments
Open

Raspberry pi4, pullup seems to be not effective. #18

michalpelka opened this issue Feb 12, 2023 · 0 comments

Comments

@michalpelka
Copy link

michalpelka commented Feb 12, 2023

Hi, foremost thank you for awesome work!

I have slight issue with button class.

#include <cppgpio.hpp>
#include <thread>
int main(int argc, char **argv) {
    health_server::setStatusHandler(mandeye::produceReport);
    std::thread http_thread1(health_server::server_worker);
    GPIO::DigitalOut out(21);
    GPIO::PushButton in(20, GPIO::GPIO_PULL::UP);

    in.f_pushed  = [&](){
        out.on();
        std::this_thread::sleep_for(std::chrono::milliseconds (500));
        out.off();
    };
    in.start();
    // blink once to test GPIO21
    in.f_pushed();
    for (;;) {
    }
    return 0;
}

It is basic code that is to trigger blink of led on output GPIO21 when GPIO20 is connected to GND.
However, it is not working, raspi-gpio says it is still pulldown mode:

pi@raspberrypi:~ $ raspi-gpio get 20
GPIO 20: level=0 fsel=0 func=INPUT pull=DOWN

When I connect to GPIO21 3.3V the GPIO20 blinks.

From my initial debbugging GPIOBase::pullupdown is not called.
I am opening issue since I do not know if I am experiencing a bug, or done smth wrong.
Kindly ask for assistance.

Repository state : 017564088be26b36cdfaa418becc62a7ed52da94
Static linking
Raspberry pi 4 
Raspbian GNU/Linux 10 (buster)
@michalpelka michalpelka changed the title Raspberry pi4, pullup is not effective. Raspberry pi4, pullup seems to be not effective. Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant