bnjmnp / pysoem

Cython wrapper for the Simple Open EtherCAT Master Library
MIT License
96 stars 37 forks source link

Issue of mechanical buttons on Raspberry pi GPIO with PYSOEM [NEED HELP] #67

Closed tom9672 closed 2 years ago

tom9672 commented 2 years ago
...
def btn_pressed(pin):
    print(pin,'pressed')
GPIO.add_event_detect(26, GPIO.RISING, callback=btn_pressed, bouncetime=200)
...

works as expected, one press and one print.

....
for cmd in [6,7,15]:
    output_data.Control_Word = cmd
    self.slave.out_put = bytes(output_data)
    time.sleep(0.02)
...
def btn_pressed(pin):
    print(pin,'pressed')
GPIO.add_event_detect(26, GPIO.RISING, callback=btn_pressed, bouncetime=200)
...

It keeps outputting that the button is clicked, but I don't get the button clicked. I tested to remove the 15, it works as expected.

tom9672 commented 2 years ago

solved, I connected the NC instead of NO contact point of the mechanical button, then the issued solved, but still don't know why ...