Skip to content

Instantly share code, notes, and snippets.

@sheabunge
Last active August 29, 2015 14:15
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 sheabunge/de7e69eb6d81ad804b26 to your computer and use it in GitHub Desktop.
Save sheabunge/de7e69eb6d81ad804b26 to your computer and use it in GitHub Desktop.
Not eXactly C line following code
/******************** 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