Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Last active December 15, 2016 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsBergqvist/c8a820af24ae0af1839c1c002dfd80c3 to your computer and use it in GitHub Desktop.
Save LarsBergqvist/c8a820af24ae0af1839c1c002dfd80c3 to your computer and use it in GitHub Desktop.
servo_wheels.py
def stop():
"""Stops the wheels"""
servos.position(left_wheel, degrees=90)
servos.position(right_wheel, degrees=90)
def fw_step():
"""Moves the bot forward one step"""
servos.position(left_wheel, degrees=90 + wheel_speed)
servos.position(right_wheel, degrees=90 - wheel_speed + drift)
utime.sleep(straight_length)
stop()
def back_step():
"""Moves the bot backwards one step"""
servos.position(left_wheel, degrees=90 - wheel_speed)
servos.position(right_wheel, degrees=90 + wheel_speed + drift)
utime.sleep(straight_length)
stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment