Code reorganized as an Arduino sketch.