Grumpy_Mike:
Given thatint maximumDistance = 50; // distance Maximale acceptée (de 0-450 cm)
int minimumDistance = 0; // distance Minimale acceptée (en cm)
The code
if (cm > distanceObstacle || cm <= minimumDistance) {
Will always be true. Would you mean to AND those two statements and not OR them? That is && in place of ||
cm <= minimumDistance
is false unless cm = 0. So it's pretty much redundant in this situation.
The thing evaluates to true the moment cm > distanceObstacle
is true, which would be cm > 10. That's sensible. Then the PasObstacle is set true, and the normal movement is done. To me this part actually looks correct.