Close

Changed to C Quadrature

A project log for Autonomous Pi bot

Autonomous Pi Bot

rlsutton1rlsutton1 03/14/2014 at 11:140 Comments

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