help understanding this bit of the code

I'm struggling to understand this bit of code.
it uses a potentiometer to set the LED blink speed but I don't fully understand it.
But I'm not sure how it uses the potentiometer value and the previous and current millis to set the blink speed.
Any help would be appreciated below is part of the code.

long PotentiometerValue1 = analogRead(Potentiometer1);

unsigned long currentMillis1 = millis();

if(currentMillis1 - previousMillis1 >= PotentiometerValue1) {
previousMillis1 = currentMillis1; // sets previousmillis as currentmillis

if (ledState1 == LOW)
ledState1 = HIGH;
else
ledState1 = LOW;

code.ino (1.32 KB)

The value returned by analogRead will be an integer in the range 0...1023.
Does that make things clearer?
Have you looked at the basic blink without delay example?

long PotentiometerValue1 = analogRead(Potentiometer1);  //read the pot

unsigned long currentMillis1 = millis();  //get the number of milliseconds since Arduino start or reboot

if (currentMillis1 - previousMillis1 >= PotentiometerValue1)  //if the period since the last reading exceeds the pot reading
{
  previousMillis1 = currentMillis1;   //save the current value ready for mext time

  if (ledState1 == LOW)  //change the state of the LED
    ledState1 = HIGH;
  else
    ledState1 = LOW;

The value returned by analogRead will be an integer in the range 0...1023.
Does that make things clearer?
Have you looked at the basic blink without delay example?

but how does it use the potentiometer after this to set the speed of the LED blink

The value read directly sets the rate.
Did you look at the blink without delay example?

but how does it use the potentiometer after this to set the speed of the LED blink

The value returned by analogRead() is used as the interval between changes to the LED state.