How to connect Ultrasonic sensor to run DC motor with Ardino and same time Soil moisture sensor for water pump

This is not a free code writing service. You try to write the code and when you get stuck or have questions, post your best effort and we will help you to get the code to work.

Your requirements lack detail. Need information. Start by reading the forum guidelines to see what sort of information that we need to be able to help you.

Supply data sheets for the motor, motor driver, moisture sensor and ultrasonic sensor.

Post a wiring diagram.

Which Arduino board?