Hi to all, I have a problem detecting inputs with my Udoo quad. I have a file listener in Java that detects when there's a change in the files under gpio's directories (e.g. /sys/class/gpio/gpioXX/...). This works perfectly with output pins because the edit date of the file changes as I echo 1 or 0 into value, but this doesn't happen for input pins..the only way to detect a change is to periodically check the content of value file for every input pin...is there any better way to detect an input signal?? couldn't be the edit date of the value file be updated on inputs? Best, Flavio
There are also polling techniques in the sysfs https://www.kernel.org/doc/Documentation/gpio/sysfs.txt See also https://developer.ridgerun.com/wiki/index.php/How_to_use_GPIO_signals Alternatively you could have a look at the following RPi java library for GPIO. It could give you inspiration with regards to the observer functionality. https://github.com/jkransen/framboos
I'm using this library https://github.com/BOSSoNe0013/NeoJava that use WatchService to detect changes of gpios files but it fails to detect changes of the value files when the pin mode is set to input and I can't understand why. In the worst case I can use this http://www.clarenceho.net/2016/05/event-driven-gpio-with-python-on-udoo.html to trigger some rest service call to my java service..
It looks like the filesystem modified method you used is not supported on GPIO https://raspberrypi.stackexchange.com/questions/19712/using-incrontab-to-read-gpios But it looks like there is no alternative in Java other than write your own for the Udoo http://stackoverflow.com/questions/34386290/how-can-i-make-use-of-epoll-in-java