- Insert the white wire into pin 9 on the Arduino board.
- Notice the standard Servo is rotating from 0 degrees to 180 degrees and pausing for 2 seconds at each position.
STEM Connections
When writing our program in step 7, we chose pin 9 to be the pin that sends instructions to the Servo. Inserting the white wire into pin 9 will allow the Servo to receive the instructions written in the void loop section of your program. The Servo will begin to move as you instructed it to in the code you wrote.
Pin 9 has a wire stuck in it
- Change boards and upload the code again.
• Note: You will need to first select the correct port before uploading by going to Tools>Port and selecting the COM# with (Arduino/Genuino Uno) next to it.
- Program another PWM pin to attach to.
• Note: This means changing the number in “myservo.attach( );” from 9 to either 3, 5, 6, 10, or 11.
- Or, teacher can use a box cutter or pliers to get it out 2.
Servo doesn’t work
- Check to make sure that the wires are all connected to their corresponding color on the Servo connector.
- Check to see that the program was successfully uploaded to the Arduino board by looking for the “Done Uploading” message on the Aarduino software?
- Check to make sure that the wires are connected to the correct pins in the Arduino board.
• Remember, Red – Vin, Black – GND, and White – Pin 9.
- If all else fails, Rreplace the sServo.
• Note: It is not uncommon for Servos to break after repeated use.
- Ask the students: Where do you think the white wire should attach to? If no one answers, remind the students: tThe answer is in the code. Which pin did we associate with the Servo? 1. Answer: 9, from the line of code, “myservo.write(9);”
- Notice how the standard Sservo goes from one position to another, moving from 0 to 180 degrees, pausing for 2 seconds at each angle.
- As with the previous 2 steps, we recommend that your students write down where the wires go, “White – 9”.
- If your students are using the Wearable Tech notebook, have them write in “9” or “Pin 9” on page 6 next to “White Wire”. You can also use page 8 to help reinforce how the code relates to the motion of the standard Servo.