Stopping the car after it goes off the line

I am currently using the Arduino UNO board car with 3 (i think it was infrared?) sensors that scan the line. i am trying now to make it automatically stop if it goes off the line. it works a little if i just put //If sensors do driving. else stop

However this way it will stop anytime it slightly doesnt detect the line, in this case the electrical tape, and only hardly goes around.

I have been sitting at this for the past 2 weeks and couldn’t figure something out so im asking here

this is the code wich im trying to modify(the part for the left sensor got cut off but its the same as for the right one.)

Any help would be appreciated :slight_smile:

It looks like you forgot to read the pins.

It's hard to tell because you didn't post all of your code, and the code you did post, you posted badly

Welcome to the forum

Pictures of code are generally not useful, as are snippets of code

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination

1 Like

presumably this means there isn't sufficient time to get back on track.

so why not add a timeout that stops it if it doesn't get back on track within that timeout period?

yeah sorry, at time of writing this i wasnt able to access it as it was on the school computer. once im home i can post the full code i used

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.