-
Gordon,
Have you seen the new NXP dual-core mcu[1] which starts at $2(for 256K/108K flash/ram) ? it might be a good fit to enable Espruino with real-time :
1 core could run Espruino with all it's benefits especially with high ram. Another core run Arduino/Mbed,exactly for those real-time tasks. People who don't care to learn Arduino/Mbed, but want to add some real-time stuff can easily copy code from the net.
I believe there are even ports of the mbed to the lpc4500(a board called bambino-200) , which is another dual core chip from nxp, so it might make the job easier.
Well, the average resolution of setInterval is actually very high (1 uS) but the speed of execution of JavaScript is really going to cause you problems - so while you could maybe get nearer 8kHz with a few lines of the inline assembler, other bits of JavaScript that run will get in the way of it.
It's a bit difficult really... You can get an accurate, very high pulse rate using the built-in timers and analogWrite, but crucially you won't be able to accurately count how many pulses have been sent out.
So if you really want the higher speeds with Espruino I guess you have three options - none of which is great: