Pi4J / pi4j-v1

DEPRECATED Java I/O library for Raspberry Pi (GPIO, I2C, SPI, UART)
http://www.pi4j.com
Apache License 2.0
1.31k stars 448 forks source link

Question - change pinMode of GpioPinDigitalMultipurpose #547

Open supertick opened 2 years ago

supertick commented 2 years ago

Hello, Thanks for the great project. I currently initialize all pins to PinMode.INPUT - but would dynamically light to change the mode depending on need to PinMode.OUTPUT.

I get com.pi4j.io.gpio.exception.InvalidPinModeException: Invalid pin mode on pin [GPIO 13]; cannot setState() when pin mode is [input]

Is there a way to do this? By perhaps deprovisioning and re-provisioning ?

Thanks kindly.

FDelporte commented 2 years ago

This has been discussed in the V2-project with a reference to an implementation in V1: https://github.com/Pi4J/pi4j-v2/issues/26