Quantcast
Viewing all articles
Browse latest Browse all 4827

Compute Module • Re: GPIO cannot read Magnetic Reed Door Sensor

That code works OK on a pizero2 running Bullseye 32-bit with Desktop.
I simulate the reed switch on GPIO16 using raspi-gpio with the script already running:

Code:

pi@pibull32:~ $ raspi-gpio set 16 op dhpi@pibull32:~ $ raspi-gpio set 16 op dl
script prints:

Code:

Door is OPENDoor is OPENDoor is CLOSEDDoor is CLOSED...
Of course, I would use gpiozero to check the input when pressed, rather than the tight loop...
Have you checked the reed switch with a multimeter - 0 ohms when closed, high resistance when open, using the magnet?

Edit: why are we in the Compute Module section?

Statistics: Posted by neilgl — Wed Aug 07, 2024 3:29 pm



Viewing all articles
Browse latest Browse all 4827

Trending Articles