Where have you ever seen digitalRead(trigPin == HIGH) && digitalRead(echoPin == LOW)) //if the sensor hits the fall in front switch reads either 0 or 1 being used to check hitting a wall with what I suppose is an ultrasonic sensor? What do you think
digitalWrite (trigPin, LOW);
delayMicroseconds(2);
digitalWrite (trigPin, HIGH);
delayMicroseconds (10);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2)/29.1;
is doing?
Also the else of this if(... && ...) is not what you document (it’s an OR not AND)
===
Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].
It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)