Skip to content

Instantly share code, notes, and snippets.

@kcranley1
Last active August 29, 2015 13:57
Show Gist options
  • Save kcranley1/9407997 to your computer and use it in GitHub Desktop.
Save kcranley1/9407997 to your computer and use it in GitHub Desktop.
My own version of drive_in_square.py
#! /usr/bin/env python
# drive_in_square.py
import time
import pibot
import sys
bot = pibot.PiBot()
# speed = 255
speed = 64
if len( sys.argv ) > 1:
speed = int( sys.argv[ 1 ] )
while True:
# Drive forward
bot.setMotorSpeeds( speed, speed )
time.sleep( 3.0 )
# Turn right
bot.setMotorSpeeds( speed, -speed )
time.sleep( speed /(255*4.0) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment