Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct setting of the initial encoder values #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BrickPi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down