Tab Content
Tab Title
Instructions
Tab Content

Warning: Be sure not to add or delete any other code at this point as this may prohibit the code from working properly.
 

  1. In the menu bar of the Arduino software, go to Sketch > Include Library > Servo.
     
  2. Notice “#include <Servo.h>” appears at the top of the code.

STEM Connections

Remember that the function “#include <Servo.h>” causes the Arduino software to add all the code from the Servo library into the code being written, but the library code will not appear in the window. The Arduino software will add the Servo library code before translating the code being input into a program. 

Tab Title
Implementation
Tab Content

It may be important for students to understand that although 2 Servos are being used, the Servo library only needs to be included once. After it has been included, we can use as many Servos as there are PWM pins that are able to control them (for the Arduino Uno there are 6), but each needs to be given a unique name. It may be helpful to remind students that by including the Servo library, it will be easier to generate correctly shaped signals for the Servo.

Tab Title
Troubleshooting
Tab Content

Can’t find ‘Servo’ in Sketch>Include Library

  1. It’s there, keep looking!

Can’t find “#include <Servo.h>”

  1. Check the very top of the sketch code
  2. Try this step again
Instruction Category
Video