We will make an activity that allows us to select the target angle for a servo motor and apply it using components of the Rainbow HAT. To do so, we will use the buttons A and B to respectively decrease and increase the target angle, which we will display on the LCD. Finally, when we tap on button C, we will apply the target angle to the servo.
This sample project combines several components on the Rainbow HAT with a servo. It serves both as a reminder of how to use those components and as a showcase of how handy they can be when performing quick tests with other peripherals.
Since we are going to use a servo, buttons, and the alphanumeric display, we will need to add the following three dependencies to our build.gradle ...