Arduino – Servo Motors

Servo Motors are able to be set to a specific position. This may be useful for steering vehicles, opening vents, or creating visual notification systems.

Note: Cheap servo motors may require that you tweak the code by a few degrees due to inaccurate sensors, or poor build quality.

Functional Parts in the Project:

#include <Servo.h> 

#define servoPin 8

Servo Servo1; 

void setup() { 

   Servo1.attach(servoPin); 
}
void loop(){ 

   Servo1.write(0); 
   delay(2000); 

   Servo1.write(45); 
   delay(2000); 

   Servo1.write(90); 
   delay(2000); 

   Servo1.write(180); 
   delay(2000); 
  
}

Be the first to comment

Leave a Reply