Ticker

6/recent/ticker-posts

Header Ads Widget

Servo motor control using potentiometer

In Servo motor control using potentiometer tutorial, we’ll control servo motor Direction based on potentiometer movement. Potentiometer is connected on analog pin A0 of arduino uno. And servo motor is connected on pin number 9 of arduino. We are using PWM to control servo motor.

Materials required

  • Arduino uno
  • Potentiometer
  • Servo motor

Circuit arrangement


Source Code :



//* Code by satyam singh. ******
//* subscribe my youtube channel from below link
//* https://www.youtube.com/channel/UCOrVJ1fDDCKDYMAYQmn6zWw
//*
//*************************************"**********************//
Servo servoa;
int potpin1 = 0;
int val1;
void setup()
{
servoa.attach(9);
}
void loop()
{
val1 = analogRead(potpin1);
val1 = map(val1, 0, 1023, 0, 179);
servoa.write(val1);
delay(15);
}

Post a Comment

0 Comments