Last active
August 29, 2015 14:15
-
-
Save sheabunge/de7e69eb6d81ad804b26 to your computer and use it in GitHub Desktop.
Not eXactly C line following code
This file contains hidden or 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
/******************** Line Follow ********************/ | |
task LineFollow() | |
{ | |
OnFwd(L_MOTOR, POWER); | |
while(true) | |
{ | |
if(SENSOR_A_BLACK) | |
{ | |
if(SENSOR_B_WHITE) | |
{ | |
Off(L_MOTOR); | |
OnFwd(R_MOTOR, POWER); | |
} | |
else Drive(); // Double black (on the line or on a green square) | |
} | |
if(SENSOR_A_WHITE) | |
{ | |
if(SENSOR_B_BLACK) { | |
Off(R_MOTOR); | |
OnFwd(L_MOTOR, POWER); | |
} | |
else // Double white (shouldn't happen) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment