Page 1 of 1

Door sensor connect to GPIO

Posted: Monday 02 November 2020 18:21
by runy
Hi mates,

I would like to connect a sensor door like this (https://es.aliexpress.com/item/32255861 ... 63c0iBdn8C) to my raspberry's GPIO.

Using SYSFS option I set the port with the following steps:

Code: Select all

sudo echo 18 > /sys/class/gpio/export
sudo echo in > /sys/class/gpio/gpio18/direction
sudo echo 1 > /sys/class/gpio/gpio18/active_low
but when I try to check the status with

Code: Select all

cat /sys/class/gpio/gpio18/value
the value is always 0

What am i forgetting?

Re: Door sensor connect to GPIO (SOLVED)

Posted: Wednesday 04 November 2020 9:16
by runy
I have changed the GPIO for the GPIO4 a now it's working well.