Hi,
I'm using Rasbian on an RPi 3.
If I execute this
cat /sys/class/gpio/gpio22/value
in Terminal, it correctly reports the state of a push-to-make switch across port#22 and Gnd (with pull-up resistor) as 1 or 0. The 1 or zero is displayed in Terminal on the next line, of course.
If I do this in my app:
S := 'cat /sys/class/gpio/gpio22/value >';
Res := fpsystem(S);
, Res always returns zero, which I guess is telling me that the command executed without error, rather than what the value on port#22 was. So, My question is, how do I read the 1 or 0 from my Lazarus app?
Btw, in my app, I want to be able to poll the input from the port many times per second, so I doubt that sending the output of cat to a disk file would be fast enough.
TIA, Martyn