Created
July 8, 2016 07:55
-
-
Save jckw/219824385d2d12e149eb49303f19d6bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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