user333869
user333869

Reputation: 577

RPi.GPIO: defined output pin not found in /sys/class/gpio

I have a python3 script which uses RPi.GPIO and defines 2 input pins and 1 output pin like shown below

GPIO.setmode(  GPIO.BCM )                # init GPIOs
GPIO.setup( 2, GPIO.IN, pull_up_down=GPIO.PUD_UP )
GPIO.setup( 3, GPIO.IN, pull_up_down=GPIO.PUD_UP )
GPIO.setup( 4, GPIO.OUT )

I want to set the status of the output also from outside of my python script with simple shell commands or manually, but I can't see a GPIO setup for /sys/class/gpio4.
The strange thing is, that RPi.GPIO creates the exports in /sys/class/gpio for the input pins as expected and I can check the status of these pins from a shell without problems.

# ls -1 /sys/class/gpio
export
gpio2
gpio3
gpiochip0
unexport

# cat /sys/class/gpio/gpio2/value
1

Where does RPi.GPIO define the output pin and how can I access it from outside of python?

Upvotes: 0

Views: 284

Answers (1)

user333869
user333869

Reputation: 577

I found that the /sys/class/gpio interface is deprecated with new kernels. Using gpio read|write commands works to get the state of the pins from outside of my python script.

Upvotes: 0

Related Questions