Skip to content

Behavior of after/watch not as expected  #86

@ElMagic1980

Description

@ElMagic1980

Hello,

i am trying to fetch a simple pressed button but doesn't work as expected.

I am using pi_piper 2.2.2.

I tried the following:

after :pin => 21, :goes => :high do puts "Button pressed" end
The result was that it was prompted "Button pressed" the whole time until i pressed the button. when releasing the button it started prompting again.

The same happend when i tried :goes => :low

I tried the rpi_gpio gem

RPi::GPIO.setup 21, :as => :input, :pull => :down print RPi::GPIO.low? 21
Here was the result correct.

I have tried following different options:
GPIO21 (Pin 40) connected to GND/3.3V
Watch/Wait functions used
Try to initialize Pin first with parameters :pin => 21, direction => in, :pull => :down (Had no idea how to use der created Pin object in the watch or wait context because there you can use only pin numbers)

I am clueless how to use the library the right way :-(

Any ideas what is wrong with my Code?

Thanks

Regards Elmar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions