Why not use the library?
But anyway with that code your main problem is that you can't use delay() to get short accurate delays. The parameter to it is an integer not a float so 2.00 and 2.99 will end up at exactly the same delay. Try using delayMicroseconds instead.
And servos aren't fussy about the pulse repetition rate so you might as well just use a constant 20ms for the off time.
BTW you might not get 180 degrees anyway. Many/most hobby servos are limited to about 120-150 degrees.
Steve