Last active
August 29, 2015 13:57
-
-
Save kcranley1/9407997 to your computer and use it in GitHub Desktop.
My own version of drive_in_square.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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