Skip to content

Instantly share code, notes, and snippets.

@garyservin
Created June 17, 2017 14:47
Show Gist options
  • Select an option

  • Save garyservin/85298a03308e1a98e20f7574f9b519b9 to your computer and use it in GitHub Desktop.

Select an option

Save garyservin/85298a03308e1a98e20f7574f9b519b9 to your computer and use it in GitHub Desktop.
import rodi
import time
robot = rodi.RoDI() # Instanciamos un objeto RoDI
while True:
distance = robot.see() # Leemos el sensor de distancia
if distance > 10: # Si la distancia es mayor a 10 cm
robot.move_forward() # Ir hacia adelante
else: # Si la distancia es menor a 10 cm
robot.move_left() # Giramos a la izquierda
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment