This project allows the user to input a position with the 4x4 keypad and have the servo move to that position. Invalid commands reset the input and all input must be three digits in length. For example, position 5 would be "005" and so on.
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Setup the Keypad
1.) Connect your keypad to digital pins 13 through 6
a. Connect the top pin on the keypad to digital pin 13 on your Arduino
b. Do the same with the rest of the pins from top to bottom using pins 12-6 on the Arduino
Step 2: Setup the MicroServo
1.) Connect your microservo to digital pin 3 on your Arduino
a. Connect the brown wire on your servo to the ground pin on your Arduino
b. Connect the red wire on your servo to the 5 Volt pin on your Arduino
c. Connect the orange wire on your servo to digital pin 3 on your Arduino
Step 3: Upload Your Code
1.) Upload the provided code to your Arduino and enjoy moving your servo arm with inputs from the keypad
Note: If your microservo is like mine and goes 360 degrees when set to a low value such as 0, change the "servoPos" variable to default to 10.