Wow, that's fantastic!
That's great! I'd never thought of using it for frequency sweeps while also reading back the result!
With a do-over - don't know where I went astray before - I was able to get easily up to 2MHz, see shot on my very old / out of calibration 20MHz Hitachi Oszi. I even can get up to 8MHz - not smoothly, but in the end with jumps. So I will shoot some new graphs with 500KHz...2MHz MW AM Radio Band - same L, but band fitting variable capacitor for tuning. Stay tuned.
Great! Yes, the PWM uses a counter with a prescaler, so as you approach the maximum frequency the value in the counter/prescaler reaches zero, which means far less accuracy :(
...but good enough for my needs.
I'm currently co-teaching a Technician License HAM Radio class and made some experiments for illustration of subject matter that involve also mc in general and Espruino in particular. This experiment is about resonance of an LC circuit.
To show how an LC filters out of the 'wave salad' / 'statics' the frequency / band by resonance a signal, I excite an LC circuit, detect a signal and measure its strength as a function of the exciting frequency. I hoped to cover the AM Radio Band - about 500...1600KHz (EDIT: and eventually I got there, post #4). L works with 0..470pF in the AM Radio Band and receives audibly AM stations with Ge diode as simple detector. Since I could (EDIT: initially) only get up to a bit more than 262.144KHz, I increased the tuning capacitor to a 22nF to experience resonances within that range at ~ 37, 52, 88 and 255 KHz, ordered by increasing signal strength..
Attached shots and clips as follows (clips are large and take noticeable time to download):
Shot 2 and f_vs_signal clip 1:
Interestingly, most of the code written is to handle the buttons and slider 'UI' and come up with the next frequency to apply. The code to get the excitement going is only a few lines 'tall'. - published at a later point.
PS: The experiment if for Quality and not Quantity... even though the values - quantities - are pretty close to the calculated values.