Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 24, 2015 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lettergram/040f2c5460d52ea92e22 to your computer and use it in GitHub Desktop.
Save lettergram/040f2c5460d52ea92e22 to your computer and use it in GitHub Desktop.
pleuro = nxt.locator.find_one_brick()
m_left = Motor(pleuro, PORT_A)
m_right = Motor(pleuro, PORT_C)
motors = SynchronizedMotors(m_left, m_right, 0)
decision = 2 # Created a variable called decision and set it = 2
while(1):
decision = forward(pleuro, motors, 80, 15)
motors.brake()
if(decision is 0): # dist traversed
random_turn(pleuro)
elif(decision is 1): # prox alarm
avoid_turn(pleuro)
elif(decision is 2): # food alarm
defend(pleuro, 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment