In this recipe, you will learn how to create a script that continually moves a servo from the lowest to the highest angle and back again, in a sweeping motion. In some ways, the code is similar to the light animations that we have seen in previous chapters, as we will change the output of the board with time delays between each change to create an animated visual effect.
In the case of servos, though, it is the attached arm that will become animated with a sweeping motion. The approach used in this recipe can be adapted to any number of projects in which you want some servo attachments to continually sweep from one position to another.