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:
- Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3
- 560 Piece Jumper Wire Kit – https://amzn.to/2MsCLjL
- SG90 Servo Motor – https://amzn.to/2lg7zHa
#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