The click is produced by comparing the number of LEDs illuminated at one instant - let us call it time t - with the number illuminated a short time T earlier in other words at t-T. My version 2 is using synchronous logic circuitry driven by a 'clock' running at several kHz which produces my clock ticks. It is bottom left with a single faint red LED next to it. I can number the ticks since the power up using the letter n, so a sample taken at the nth tick of the clock is Sn, and n is increasing from 1 to infinity.
As there are eight LEDs on my ruler, I sample at regular time intervals of T, to see which ones are on or off. This produces an eight bit sample word viz Sn= ( L1, L2, L3, L4, L5, L6, L7, L8). If an LED is lit Lx = logical 1 otherwise Lx = 0.
I then load Sn into an 8 bit register called P. Several clock periods later - T - the contents of P are loaded into another 8 bit register Q.
After another interval of T another sample, Sn+1, is taken of the LED ruler state, Sn+1 and loaded into the register P. The content of P is now Sn+1 - the latest sample - and the content of Q is Sn - the previous sample. After a further interval of T the content of P is loaded into Q. And this sequence repeats over and over again.
Registers P and Q therefore hold samples taken at Sn+1 and Sn respectively as n counts upwards. I could write this as Sn and Sn-1 which makes it clearer with is the latest sample Sn and which was the previous sample Sn-1.
An 8 bit logical comparator compares the contents of P and Q by doing the subtraction X = P - Q. If X = 0 then Sn = Sn-1 which means there has been no change of the state of illumination of the LEDs on the ruler over the interval T. If X does not equal 0 then more or less LEDs are illuminated now than there were before.
https://www.ti.com/lit/ds/symlink/sn54ls684.pdf?ts=1617648996931&ref_url=https%3A%2F%2Fwww.google.com%2F
The logical state of X then is a signal on whether the number of LEDs which are lit is steady (X = 0) or changed over successive time intervals T.
I use the X signal to gate a 1kHz square wave to the sounder to make the beep. Actually, because X is such a short duration pulse since T is actually very short in time I send X to a pulse stretcher (a monostable) to produce a longer gate pulse. This creates the click sound every time there is a single change of state - on to off or off to on - of the most significant LED.