Four cases must be managed by this function (which should perhaps be renamed).
- no white line is detected
- the right sensor detects a white line
- the left sensor detects a white line
- both sensors detects a white line
the last case seems to be forgotten
PS: maybe add an enum to make the return values clearer
|
int ligneBlanche() |
|
{ |
|
// si le capteur de ligne blanche avant gauche ou droit est activé |
|
if (analogRead(TCRT_G) <= SEUIL_GAUCHE) { |
|
return AV_GAUCHE; |
|
} else if (analogRead(TCRT_D) <= SEUIL_DROIT) { |
|
return AV_DROIT; |
|
} else { |
|
return 0; |
|
} |
|
} |
Four cases must be managed by this function (which should perhaps be renamed).
the last case seems to be forgotten
PS: maybe add an enum to make the return values clearer
sumobot-code/code/basic/sumobot.ino
Lines 364 to 374 in 11e8458