Minor loop bugfix; connect new code to rPi