Since Java is unsuitable for reading quadrature I've chosen to write some C code to read the quadrature encoders, which I can poll from java at regular intervals. I found working C quadrature code here.
I'm spawning a C process from java for each track's quadrature. The C code continually monitors and updates the quadrature position, but only reports it back to java (via stdout) when the java code "asks" for the current value by sending a single arbitrary character (via stdin). This was all quite straight forward, but I lost about 2 hours because I forgot to flush stdout from the C end of things.
C code is here
Java code is here
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.