From c06ec868e437e170904fb6b3e4942fe6a939618a Mon Sep 17 00:00:00 2001 From: Stephan Poole Date: Sun, 6 Mar 2016 17:25:09 -0800 Subject: [PATCH] Correct setting of the initial encoder values Fixed indentation so that initial encoder values are always set at the same level that the final values are set. --- BrickPi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BrickPi.py b/BrickPi.py index f2f367e..c0fef1f 100644 --- a/BrickPi.py +++ b/BrickPi.py @@ -356,7 +356,7 @@ def motorRotateDegree(power,deg,port,sampling_time=.1,delay_when_stopping=.05): BrickPi.MotorSpeed[port[i]] = -power[i] else: BrickPi.MotorSpeed[port[i]] = 0 - init_val[i]=BrickPi.Encoder[port[i]] #Initial reading of the encoder + init_val[i]=BrickPi.Encoder[port[i]] #Initial reading of the encoder final_val[i]=init_val[i]+(deg[i]*2) #Final value when the motor has to be stopped;One encoder value counts for 0.5 degrees run_stat=[0]*num_motor while True: