Search the Blog

Wednesday, August 14, 2019

Arduino uno board of servo motor

Servo Motor Rotation For Perticular length

Servo Motor Rotation For Perticular length and Stop

#include <Servo.h>

Servo myservo;


int pos = 0; 

void setup()
{
  Serial.begin(9600);
  myservo.attach(9);
}

void loop()
{
  int sensorValue = analogRead(A0);

Serial.println(sensorValue);
  if(sensorValue>850)
  {
    myservo.write(0); 
      delay(5000);                               
  }
 else
 {
  myservo.write(90);
           
}
}


No comments:

Post a Comment

Translate