OK I'm a total noob at Arduino programming and have this project I would love to see working, I have the basic servo sweep code from the Arduino examples (below) but need to add three potentiometers to adjust the left angle sweep, the right angle sweep and the sweep speed, can anyone help this 64 year old newb at his new hobby?
MODERATOR NOTE: Welcome to AAC. Please use [CODE] tags when posting code. There is an editor in the ••• dropdown of the toolbar, choose the </> Code option. I‘ve done it for you this time, and you can see why we prefer to have posters use them.
Thanks in advance for any help
MODERATOR NOTE: Welcome to AAC. Please use [CODE] tags when posting code. There is an editor in the ••• dropdown of the toolbar, choose the </> Code option. I‘ve done it for you this time, and you can see why we prefer to have posters use them.
Arduino Servo Sweep Demo:
#include <Servo.h>
Servo myservo;
int pos = 90;
void setup()
{
myservo.attach(9);
}
void loop()
{
// *** low number left angle - high number right angle I need a pot to adjust the left angle between 77 and 90 degrees and adjust the right angle between 90 and 112 degrees ***
for(pos = 77; pos <= 112; pos += 1)
{
myservo.write(pos);
// *** sweep speed I need a pot to change the delay between 20 and 40 ***
delay(20);
}
for(pos = 112; pos>=77; pos-=1)
{
myservo.write(pos);
delay(20);
}
}
Last edited by a moderator: