Trouble with GPIO pin sensing and setting from python
We are having trouble with python and GPIO status access. A little test program works after the omega Pro boots but after a couple of minutes the same python program fails with a IOError: [Errno 16] Resource busy error.
We did see some community posts from around 2017 referring to this same condition and it seems no final resolution was offered. We are using Omega2 Pros with 0.3.2 b222 firmware.
We are running node-RED on the Pros, but even if I kill the node-Red process, the resource busy error keeps recurring. A reboot will make the error disappear but only for a few minutes.
Is there a simple bit of python logic that will free the GPIO?
We are currently using GPIO pins 1 and 2 for our tests. Eventually we want to invoke python scripts from node-RED flows that deal with sensing and setting GPIO pin conditions.
A bit more community searching led me to the command line:
echo 1 >/sys/class/gpio/unexport
that will free a GPIO pin apparently -- in this case pin 1.
Then the python program that was failing works again.
Can we do something like that from python itself?