Operation and uses
Code
Read moreServo motor are special motors which have a rotation angle that can vary (from 0 ° to 180 °).
What moves the position of the servo is an engine inside followed by gears, they can be in plastics or metal.
The servos are used to operate mobile parts : fins, shutters for planes, steering control in the case of car modelling...
First, you must have the library servo.h.
#include <Servo.h>
Then, you can control your servo.
#include <Servo.h>
Servo myservo; // declares utlisation of a servo nammed " myServo "
void setup ()
{
myservo.attach(9); // servo connected on the pin 9
}
void loop ()
myservo.write(0);
delay(1000);
myservo.write(180);
delay(1000);
}
Comments
Please log in or sign up to comment.