Servo Motor Control by Arduino Analog Pins
by heemanthy in Circuits > Arduino
813 Views, 2 Favorites, 0 Comments
Servo Motor Control by Arduino Analog Pins

Hai this project is to check that arduino analog pins can be used for servo control by same servo.h library to check the working go to the tinkercad website link:- https://www.tinkercad.com/things/462Xk6ESORW-servos-control-with-analog-pin
Supplies
arduino - 1
servo - 4
usb - 1
jumper cables - 12
Code
// the below code is the sample testing code to check the process
#include <Servo.h>
Servo S1, S2, S3, S4;
void setup()
{ // A0, A1, A2, A3 are analog pins connected to servos.
S1.attach(A0);
S2.attach(A1);
S3.attach(A2);
S4.attach(A3);
}
void loop()
{
S1.write(90);
delay(1000);
S2.write(90);
delay(1000);
S3.write(90);
delay(1000);
S4.write(90);
delay(1000);
S1.write(0);
delay(1000);
S2.write(0);
delay(1000);
S3.write(0);
delay(1000);
S4.write(0);
delay(1000);
}