Extending Ranger with Ultrasonic Sensor


I am new to mblock and I’ve built the ranger with my son. Steering it with my mobile via bluetooth is working and now we want to move ahead and extend the default capabilities to also use the ultra sonic sensor.
In other words, the ranger should still be controlled via bluetooth but it stops when it is near to an object.

How can I do that?