Does my servo have a problem? or is it my code?

I see code to make the servo go to 180 degrees but I see no equivalent code to make it go to 0 degrees.

It would be more normal to put servo.attach() in setup() so it is only called once but I'm not sure why you are using servo.detach(). If you really need servo.detach then you obviously also need servo.attach() in loop(). Servo.detach is not usually needed.

...R