I'm able to write to GPIO pins with sysfs with the standard commands like
echo "1" > /sys/class/gpio/gpio6/value, but that only turns the pin on or off.
echo "0.5" > /sys/class/gpio/gpio6/value and
echo "50%" > /sys/class/gpio/gpio6/value but those give an
Invalid argument error.
I tried looking it up, but couldn't find any examples of sysfs PWM usage for the GPIO interface. 😒
How can I use PWM with sysfs?
(I put together a fan module a couple of years ago and wrote some software to control it as well as to automate it whenever the board gets hot, and that worked fine. But I want to make it so that it's not always blasting 100% when it turns on, I want it to blow according to the temperature. I switched the (two-wire) fan to a PWM pin and can turn it on and off as before, but I need to control its duty-cycle. This is technically an XY-problem for me, so any solution would be great, but one answering this specific question would also help others wondering this for other applications.)