Page 1 of 1

Can only read state of pin 7. Is it special?

Posted: Sat May 09, 2020 12:09 pm
by Roaders
Hi All

I am using this node package:

https://github.com/JamesBarwell/rpi-gpio.js

to read the state of the gpio pins. I have got it working using pin 7 fine (the pin that all the examples use) but I can't seem to get it to work with any other pins. I have tried pin 11 and 13 also.

Is there something special about pin 7?

Pin 7 returns true when no wire is connecting it to ground and returns false when it is connected to ground.
All the other pins return false all the time.

I have tested on a pi 3 and a pi 4.

Really struggling to see what I am doing wrong here.

Thanks for any help.

Re: Can only read state of pin 7. Is it special?

Posted: Sat May 09, 2020 12:16 pm
by trejan
Roaders wrote:
Sat May 09, 2020 12:09 pm
Is there something special about pin 7?
Pin 7 aka GPIO4 is one of a handful of GPIO pins that default to having the pull up enabled. This means it will be high unless something pulls it low. Look at the Pull column on https://elinux.org/RPi_BCM2835_GPIOs
Roaders wrote:
Sat May 09, 2020 12:09 pm
I have tried pin 11 and 13 also.
Pin 11 aka GPIO17 and pin 13 aka GPIO27 should work. Not sure why it doesn't work for you.

Re: Can only read state of pin 7. Is it special?

Posted: Mon May 11, 2020 6:14 am
by Roaders
OK, yes I was being stupid. Earthing pin 7 transitioned it from high to low. Earthing pin 13 (which is already low) had no effect.

Connecting pin 13 to 3v makes it high so figured that one out. Thanks for the help.