ashraf_minhaj
Published © LGPL

How to Use ServoTimer2 Library (Simple Explain) Servo Sweep

Avoid conflict with other libraries, use ServoTimer2 and run servo motors with ease.

BeginnerFull instructions provided1 hour34,911
How to Use ServoTimer2 Library (Simple Explain) Servo Sweep

Things used in this project

Story

Read more

Schematics

ServoTimer2.sweep.circuit

ServoTimer2.sweep.code

Code

Servo seep.code

C/C++
#include<Servo.h>
Servo servo1;
void setup() 
{
servo1.attach(6);   // put your setup code here, to run once
}
void loop() 
{  // put your main code here, to run repeatedly:
servo1.write(0);
delay(1000);
servo1.write(90);
delay(1000);
servo1.write(180);
delay(1000);
}

ServoTimer2.sweep.code

C/C++
#include"ServoTimer2.h"
ServoTimer2 servo1;
void setup() 
{
servo1.attach(6);   
}
void loop() 
{                 // put your main code here, to run repeatedly:
servo1.write(750);  //min pulse width for 0 degree
delay(1000);
servo1.write(1500);  //pulse width for 90 degree
delay(1000);
servo1.write(2250);  //max pulse width for around 180 degree
delay(1000);
}

Credits

ashraf_minhaj

ashraf_minhaj

5 projects • 80 followers
Love to kill Soft things with Python and C++, Hard things with Soldering Iron.

Comments