Skip to content

Instantly share code, notes, and snippets.

@jckw
Created July 8, 2016 07:55
Show Gist options
  • Save jckw/219824385d2d12e149eb49303f19d6bc to your computer and use it in GitHub Desktop.
Save jckw/219824385d2d12e149eb49303f19d6bc to your computer and use it in GitHub Desktop.
import pi2go, time
def endCheck():
start = time.time()
# While still on the line, go forwards
while not pi2go.irLineLeft and not pi2go.irLineRight():
forward(slow)
# Now off the line
# Go forwards for one second, checking for another line
while time.time() < start + 1:
if pi2go.irLineLeft() or pi2go.irLineRight():
return True
forward(slow) # Move slowly forward
# If no line is found, it is not the end point
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment