for(pos1 = 90; pos1 <= 180; pos1 += 1) // goes from 0 degrees to 90 degrees in steps of 1 degree
If you are going to have comments that state the obvious, at least make them correct.
Can anyone tell what I have done wrong here?
Without knowing how you have powered the servos? No.