hi there... i'm fairly new to coding and i have a project making an autonomous vehicle go around a course where by it has to go around a course with various obstacles. i have a load of functions written out that all work and work together just in a loop, but trouble starts where when i attempt to make 'States' (not sure if this is the right way to describe it), the states all reset themselves back to zero if there are more than 2 states. i am using if functions with the code necessary to pass each stage of the course with a measurable 'completion' criteria.
I know my code is mess and that's because I've just brought it together and like i said I'm rather new to this. Any help or direction would be appreciated. the code and a picture of the course is attached. The distance Values of 0 are because 0 is the maximum distance
bringing_it_together.ino (6.51 KB)