GoPiGo stopping after bumping

Hello,

Is there a function that I can use to stop the motors from the GoPiGo when bumping to an obstacle.
Or when bumping to something and that the robot go’s backward.

Do you have a ensample script for me ?

Thanks

Hey input,
There is nothing as such to sense for obstacles and stop the GoPiGo, but maybe you can use a distance sensor to keep reading the distance value and if it does not change for a while, just stop the motors.

-Karan