Personally, I use shell scripts for simple tasks. That includes poking GPIOs to control things. I have scripts that run from cron, check some conditions, check the state of a GPIO and change it if necessary. The script then exits.
I expect 1. The GPIO to stay in the state I've set, and 2. to be able to read the current state of the GPIO.
One day I may code them in C using some library, but the same conditions apply. Other languages I use don't have libraries for GPIO control, so they call shell commands.
Writing the current state to a file is a bodge, and should not be necessary, especially when the hardware fully supports that situation. I remember when the Pi 4 came out when you could finally read the state of the Pulls Image may be NSFW.
Clik here to view.
I expect 1. The GPIO to stay in the state I've set, and 2. to be able to read the current state of the GPIO.
One day I may code them in C using some library, but the same conditions apply. Other languages I use don't have libraries for GPIO control, so they call shell commands.
Writing the current state to a file is a bodge, and should not be necessary, especially when the hardware fully supports that situation. I remember when the Pi 4 came out when you could finally read the state of the Pulls Image may be NSFW.
Clik here to view.

Statistics: Posted by rpdom — Tue Jan 09, 2024 10:38 am