After some fiddling with the code, the circuit works. Delays seem to be fine. Results seem to be fine. Found out how to control the serial port. I should upload some shell scripts to make life easier when using a campus pc. I managed to cover up the effect of the earth loops, so the circuit is stabilised properly.
Now, it’s on to matlab, and will need to spend time thinking about the implementation.