NPC Turn and Face Walking Direction

I have a simple NPC character walk left or right. When it bumps into an object, Id like it to turn around and walk the opposite direction. The walking I have no problem, I just need it to rotate 180 degrees into the direction its facing. Im sure this has been talked about before, but Im not finding much on a direct answer for NPCs instead of the PC.

What would be the best way to simple rotate him 180 degrees upon changing his direction? Slerp? SmoothDamp?

This is part of my menu that is under construction at the moment, it is used to rotate the menu around a camera that is following a space ship. You should be able to rehash it for your NPC

NB the commented out line of code was meant to set to an exact rotation.

// main loop for animation
    void Update() 
    {
		if (clicked)
		{
			fromRotation = pivot.transform.rotation;
			toRotation = Quaternion.Euler(0,-target,0);
			pivot.transform.rotation = Quaternion.Lerp(fromRotation,toRotation,Time.deltaTime  * lerpSpeed);
			count += 1;
			// reset
			if (count >= 150)
			{
				count = 0;
				clicked = false;
				//pivot.transform.eulerAngles = new Vector3(0, target, 0);
			}
		}
    }