In this lab, you will using a 4x4 keypad to change the angle of a servo motor. The angle will be determined by a 3 digit input using the keypad. The keypad will not accept not numeric values.
Hardware required for this project:
1. Arduino Uno
2. 4x4 keypad
3. Servo motor
Step 1: Connecting the 4x4 Keypad
To connect the 4x4 keypad, connect each pin on the keypad with a pin on the ardunio using a jumper wire. The pins used in the diagram are pins 4-11.
Step 2: Connect the Servo Motor
The servo motor requires 3 connections to the Arduino board:
1. Connect the ground wire to the GND port on the Arduino
2. Connect the power wire to the 5V port on the Arduino
3. Connect the output wire to one of the available ports on the Arduino, port 3 was chosen in the diagram
Step 3: Code for Keypad Operated Servo Motor
Attached is the 1200_FinalExam_Project2.ino file which contains all of the code required for this project. The code prevents invalid entries by the user. If the user enters a non-numeric value, the angle of the servo is set to 0 and the user starts the data input over. If a number larger than 180, the servo's max turn radius, the angle is automatically set to 180.