// 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'..
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
servo1:GND
servo1:V+
servo1:PWM
pot1:GND
pot1:SIG
pot1:VCC
pot2:GND
pot2:SIG
pot2:VCC
Slow
An example of the slowServo library.
Fast
0
180
led6:A
led6:C