@groundFungus - Thanks for replying so quickly! I suspected that the for loop might be causing some problems. However, my earlier code used a while loop and I had the same issue with that. Do you think it might work better if I use a simple function to set servoPos, it might help tidy up the if statements. I've been looking around for possible solutions to this on the internet and it seems that this is a common problem with any code that tryrs to sweep a servo back and forth whilst doing something else. Anyway, I'll have a look at the examples you've linked and then let you know how it goes.
Thanks again!