So I am trying to code for a car controlled by an Arduino Uno that needs to start from the middle of an open box, touch the right wall and play a tone, touch the left wall and play a tone, then return back to it's starting position.
So far I have code with states for turning left, right, going forward and backward, but I am unsure how to string them together.
What I write here may sound a bit rude. It is not meant rude. It is meant to be clear and easy to understand.
If you want help you should make it as much comfortable for your potential helpers instead of making it most comfortable for you. Post code inside code-tags.
In your code add your first approach how you think the code inside your state1(), state2()-function looks like
It does not even have to compile. Just a small starting point that shows some effortinvested by YOU
or as an alternative
post at least one single BUT CONCRETE question about one line of code instead of a generalised question like
"So far I have code with states for turning left, right, going forward and backward, but I am unsure how to string them together."
What your code shows so far is copy&paste from a tutorial and a few minor changes to the copied code.