I'm just guessing here but shouldn't this:
for(pos=180;pos>=1;pos--)
be this: for(pos=180;pos=0;pos--)
for(pos=180;pos=0;pos--)
?