Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import random
- from duinobot import *
- board = Board("/dev/ttyUSB0")
- board.report()
- robot = Robot(board, 5)
- try:
- while True:
- robot.forward(10)
- print "Distancia:", robot.ping()
- robot.beep()
- if robot.getObstacle():
- print "choque!"
- angulo = random.randint(0,100)
- print "girando", angulo, "grados!"
- robot.turnLeft(angulo, 0.5)
- time.sleep(1)
- finally:
- robot.stop()
- board.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement