Skip to content

Instantly share code, notes, and snippets.

@kcranley1
Last active August 29, 2015 13:57
Show Gist options
  • Save kcranley1/9408042 to your computer and use it in GitHub Desktop.
Save kcranley1/9408042 to your computer and use it in GitHub Desktop.
My version of robot_teleop.py
#! /usr/bin/python
# robot_teleop.py
import pibot
import time
TURN_TIME = 0.2
bot = pibot.PiBot()
while True:
# Read commands from the user
command = raw_input( ": " )
command = command.strip().lower()
if len( command ) > 0:
commandLetter = command[ 0 ]
if commandLetter == "f":
bot.setMotorSpeeds( 128, 128 )
elif commandLetter == "b":
bot.setMotorSpeeds( -128, -128 )
elif commandLetter == "l":
bot.setMotorSpeeds( -128, 128 )
time.sleep( TURN_TIME )
bot.setMotorSpeeds( 0, 0 )
elif commandLetter == "r":
bot.setMotorSpeeds( 128, -128 )
time.sleep( TURN_TIME )
bot.setMotorSpeeds( 0, 0 )
elif commandLetter == "s":
bot.setMotorSpeeds( 0, 0 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment