matrix-io / matrix-creator-malos

MATRIX Creator abstraction for MOS
GNU General Public License v3.0
19 stars 18 forks source link

Read Value of GPIO 16 with Malos #72

Open manzonif opened 7 years ago

manzonif commented 7 years ago

Hi, I'm trying to reproduce this sample python script with Malos and protobuffer, but I can't read the value of GPIO 16 in the updateSocket.on('message'.

Here the python code:

`import RPi.GPIO as GPIO from time import sleep

def my_callback(channel): if GPIO.input(16): # Pin 16 print "Rising"

if name == "main": GPIO.setmode(GPIO.BCM) GPIO.setup(16, GPIO.IN) GPIO.add_event_detect(16, GPIO.RISING, callback=my_callback, bouncetime=400)

try:
    sleep(120)
    print "Time's up. Finished!"

finally:
    GPIO.cleanup()`

My basic idea is to use the IR sensor as a trigger button, like in alexa demo.

Any suggestion?

[Update] Sorry. Really bad question. There are lot of node modules like RPi.GPIO library, (e.g. onoff).

I have some problem with noise on pin 16 and I'm trying to find the right workaround.