Sub btnLeft_Click
btnStop_Click
NewServiceMessage("Turning Left " , "", 1, 1000)
Dim lCurrentHeading As Long
Dim lTargetHeading As Long
Dim lAdjustedHeading As Long
lTargetHeading = lCurrentHeading - lTurnDegrees
If lTargetHeading < 0 Then
lTargetHeading = lTargetHeading + 360
End If
Do
lCurrentHeading = Heading
If lTargetHeading > (360 - lTurnDegrees) AND lCurrentHeading < lTurnDegrees Then
lCurrentHeading = lCurrentHeading + 360
End If
pinMotor4.DutyCycle = CurrentDutyCycle
pinMotor3.DutyCycle = CurrentDutyCycle
Loop While (lCurrentHeading < lTargetHeading)
End Sub