Reading a slide switch

In this recipe, we will learn how to create a program that will repeatedly print whether a slide switch is on or off. Slide switches have their own strengths, and this recipe will demonstrate how you can incorporate one into your project.