arduinohelp:
Hi everyone, I don't have an ultrasound sensor. I just have switches. Sorry I didn't clarify that before!And I did write the code combining random snippets I found on stack overflow so that is the reason why it won't work altogether.
Just as I thought.
So, you have a front switch and a rear switch each attached to an Arduino pin.
Give the pins sensible names so that the rest of the code is easier to read.
Write a small program that tests whether they work
I suggest that you set the pinMode()s INPUT_PULLUP and wire them to go LOW (ie to GND) when activated.
Print a message when you discover that one of them is activated
Post the code here and we can then provide help as to what to do next.
Use code tags when you post the code.