Connect the VCC and GND pins of the ultrasonic sensor to the 5V and GND pins of the Arduino board, respectively. Connect the TRIGGER pin of the ultrasonic sensor to digital pin 8 of the Arduino board.
The code of my 2017 sumo robot, using an arduino nano, two HC-SR04 ultrasonic sensors, two TCS3200 color sensors and a L298N motor controller.