Arduino - 'setLocked' was not declared in this scope

Once you fix the brackets, you need to define your variables 'pos' and 'myservo'.