[SOLVED] Needing an LED sequence while the servo is moving

Hello there. This is my first time in the forum, so I’m sorry if I’m committing an error. Also, english isn´t my native language.
I’ve a school project, which consist in a servo controlled by an varible resistor. I need an LED sequence indicating the direction in which the servo is moving.
Hope that you guys can understand what I’m talking about

#include <Servo.h>
Servo servo1;

int control = 3; //Servo's Pin
int mini = 1000;
int maxi = 2000;
int POTV; //Variable resistor's value
int ang; //Angle
int POT = 0; //Variable Resistor's pin

void setup() {
  // put your setup code here, to run once:
servo1.attach(control, mini, maxi);
servo1.write(0);
}

void loop() {
  POTV = analogRead(POT);
  ang = map(POTV, 0, 1023, 0, 180);
  servo1.write(ang);
  delay(250);

}

More members will see your code if you post it as described in the forum guidelines.

school project ?

There is a servo and LEDs in Several Things at a Time - it should give you some ideas.

...R

gcjr:
school project ?

Yep, I don't know how it is said in english (i think it's polytechnic). I study electronic devices, and due to the quarantine, I'm taking classes from home and my teacher isn't helping that much...

To know the direction you need to save the last value you wrote to the servo.
The sign of the difference of the old value and the new value will give you an indication of the direction of movement.

Robin2:
There is a servo and LEDs in Several Things at a Time - it should give you some ideas.

...R

Thanks sir :D. This was very helpful

I need an LED sequence indicating the direction in which the servo is moving.

What kind of LED’s ? if you want to use individually addressable ones like Neopixels, than using Servo.h to control the Servo is not going to work properly.