added test for PWM sonar input. Also added basic loop functions