• Thanks for the details.
    As a first try you can use the setWatch function. When the given callback is called, the parameters lastTime and time are passed to it. by doing 1/(time-lastTime) you get the frequency value.
    The limitation could be the processing time of the callback, but you can go up to 1kHz easily as far as I remember. Then you can maybe adjust the RC constant of your 555 circuit in order to decrease the maximal output frequency.