SHARE
TWEET

CamJam Kit #3 gpiozero Obstacle Avoidance

sweenig Oct 31st, 2016 (edited) 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from time import sleep
  2. from gpiozero import CamJamKitRobot, DistanceSensor
  3. bot = CamJamKitRobot()
  4. front = DistanceSensor(24,25)
  5. while True:
  6.   bot.forward()
  7.   front.wait_for_in_range()
  8.   bot.stop()
  9.   bot.reverse()
  10.   sleep(0.25)
  11.   bot.left()
  12.   sleep(1)
RAW Paste Data
Top