Serial pi code, copied in from reference code

Closes #8.