I have found this code to follow line (black on white background) in a past post (which is now closed).
I am “recycling” the image 'cause there is something I do not understand:
- The last if has the same instruction “turn right” in both cases… Why?
- One reaches at the last if only if previouses if are not true (so l1r1 or l1 or r1 are not on the black line). That should mean that l1 and r1 are both on the background… In this case the mbot should stop and go back… why “go right”?
May be I didn t get the whole sense of the nested ifs