The steps motors 28byj-48

I'm doing a project, and a part of it is making the step motor 28... to go left(or right) when an ultrasonic
detector detects that the distance is less than 6 cm.
I don't get how to make the steps motors spin when the ultrasonic detects it.
I would want to do a little "car" that moves in a direction, and when it's to close to an obstacle spins and continues.
i already know how the ultrasonic sensor works and how the step motor works but i m not very good in coding and i haven't achived to make what i am trying to do.

(deleted)