How do I set the pullup using /sys/class/gpio/gpio$PIN/
echo 1 > /sys/class/gpio/gpio$PIN/value
does not seem to work.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityI'm not sure that you can set the internal pull-up/pull-downs via the sysfs interface. I have never done so, but I don't often use sysfs.
From the command line there are many methods. The following examples assume Broadcom gpio 4.
pigpio
pigs pud 4 u # up
pigs pud 4 d # down
pigs pud 4 o # off
raspi-gpio
raspi-gpio set 4 pu # up
raspi-gpio set 4 pd # down
raspi-gpio set 4 pn # off
wiringPi
gpio -g mode 4 up # up
gpio -g mode 4 down # down
gpio -g mode 4 tri # off
/sys
. You can only set the direction and check/set the value.
gpio
, which works, but I was hoping there was a method not dependant on installing other software. There seems to be a dearth of documentation on the /sys
interface.
Sep 21, 2015 at 4:40
/sys
is in the vanilla source tree, [src]/Documentation/gpio/sysfs.txt
(also online). It's not specific to the pi, which is why it doesn't include stuff like the pull-ups or alt functions. The people responsible for the rpi kernel could have elaborated upon this and created a kernel driver for the pi, but AFAIK they didn't and neither did anyone else -- there is just the various userspace libraries.
gpioset
through "libgpiod" ?