LED "pulse" instead of "blink"

Wow, it is soooo simple, thank you JaBa!!!
You've just made my day.

Ok, next problem :smiley:

I've expanded my code, with another pot.

As you can see, the pot generates a number between 10 and 100, and compares it into a random generated number (0-100) every time if "tick" is HIGH.
If "density" bigger than "comparator" then it sends a "pulse" to digital out 4.

The problem is that it is not working...

I think the problem is that I'd like write them in the same time maybe?

const int tick = 3;
const int tock = 4;
 
int tickState = LOW;
int tockState = LOW;
unsigned long previousMillis = 0;

void setup() {
  pinMode(tick, OUTPUT);
  pinMode(tock, OUTPUT);
  Serial.begin(9600);
}
void loop() {
  unsigned long currentMillis = millis();
  int clockspeed = map(analogRead(0), 0, 1024, 1000, 10);
  if (currentMillis - previousMillis >= clockspeed) {
    previousMillis = currentMillis;
    if (tickState == LOW) {
      tickState = HIGH;
      digitalWrite(tick, tickState);
      delay(7);
      digitalWrite(tick, LOW);
    } else {
      tickState = LOW;
    }
    Serial.println(clockspeed);
  } 
}
void loop2 (){
    if (tickState = HIGH) {
      int comparator = random (0,100);
      int density = map(analogRead(1), 0, 1024, 10, 100);
      if (comparator < density) {
        digitalWrite(tock, HIGH);
        delay(7);
        digitalWrite(tock, LOW); 
        } else {
        tockState = LOW;
        }
      }
}