Using IR obstacle avoidance sensor to trigger my motors


I have been able to successfully control my motors using the L298N board and the arduino. I am now trying to trigger my motors using an IR obstacle avoidance sensor. I just don't know how to combine the code and the connections ?


I didn't mention that i want to do this to trigger the boom gates of my model railway.

We can not see your project. If you want help with code, post it along with a description of what the code actually does and how that differs from what you want it to do. Please read the "how to use the forum" stickies to see how to format and post code. If you want help with hardware, we need to know exactly what you have and how things are connected. That means you should provide data sheets or specifications for each component (within reason). A block diagram of the component and connections, at a minimum. A schematic is very much preferred.