im making a programmbale robot car for my college project and I want my robot to stop after the sensors are activated. the sensors are two switches connected at the front of the robot. When the robot comes in contact with an obstacle the switches get pushed by the object at which the motors should stop.
I have tried to use if statments to achieve this but have had no success in doing so. Can someone perhaps show me a way which this could be achieved. the pin which is connected to the sensors is digital pin 1. the pins connected to the motors are pins 11, 5 which drive the robot forward and 6, 3 reverse the motors.