adding a beep to my robot car

i have a code for my robot car to avoid obstacles but i want to add a new feature that will make the car beep once its new to an object and i dont no how to code this or add it

i have a code for my robot car

that we cannot see.

Try again.

attach a piezo speaker and use tone () function with value around 4500 and time 200 ms.

tone (TONE_PIN, 4500, 200);

Eff_jay:
thanks for the reply. Thought i might get futher explanation.

https://www.arduino.cc/en/Tutorial/ToneMelody