// https://wokwi.com/projects/358434260375219201
#include <slowServo.h>
#include <mapper.h>
// THIS CODE RELIES ON THE LC_baseTools & LC_slowServo libraries
// those can be installed using the Arduino library manager.
slowServo aServo(2); // Create a slow servo given a pin number.
mapper potToDelayMapper(0,1023,0,100); // Set up a mapper from a POT to 0..100 Ms delay.
mapper potToAngleMapper(0,1023,0,180); // Set up a mapper from a POT to span 180 deg.
void setup() {
aServo.begin(); // You need to call begin for each servo.
pinMode(3,OUTPUT); // We need an LED to blink. Doesn't everyone?
}
void loop() {
idle(); // idle(); Runs everything.
aServo.setMsPerDeg(potToDelayMapper.map(analogRead(A0))); // Read position POT, scale, set the sevo.
aServo.setDeg(potToAngleMapper.map(analogRead(A1))); // Read delay POT, scale, set the sevo.
digitalWrite(3,aServo.moving()); // Yeah, we know when it's running. Kinda'..
}
Slow
An example of the slowServo library.
Fast
0
180