Motor for Steering Problem

What should i add to my coding to make it rotate 45 degree only?

You need to tell us what type of motor that is, and how it is normally controlled.