Moving Gradually

Part 4: Moving your Servo Gradually Between Minimum and Maximum Positions

Create new variables to hold the max and min positions that you wrote down in the part 2. Don’t use my values, use yours.

Change your old code to look more like this. Once you have made the change, the code will not allow your servos to exceed the maximum position.

You could also change the speed of your servos by changing the value that the servo position variable gets added/subtracted by in these lines of code…

You might be done... stop and think about how you want your servo to move!

Last updated

Was this helpful?