joan2937 / pigpio

pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO).
The Unlicense
1.43k stars 403 forks source link

[Support question and proposal] How to set a GPIO pin to default HIGH before setting it to output? #570

Open Wikinaut opened 1 year ago

Wikinaut commented 1 year ago

https://raspberrypi.stackexchange.com/a/90002 explains for the RPi.GPIO library how an initial value can be defined when setting up an output pin:

Initial output value - RPi.GPIO library only -

GPIO.setup(17, GPIO.OUT, initial=GPIO.HIGH) # GPIO 17 as output, initial value high

I could not find a similar option in your library setup for Python (Raspberry-Pi-use):

https://abyz.me.uk/rpi/pigpio/python.html#set_mode

pi.set_mode(17, pigpio.OUTPUT) # GPIO 17 as output

Proposal

I propose to add an optional parameter in pigpio.set_mode for initial values when defining output pins.