The timer Espruino uses at the moment is the 32kHz RTC, so while theoretically you could do that, you're limited by the speed of execution. You can test with:
counter = 0;
var i = setInterval(function() { counter++; },10);
setInterval(function() { console.log(counter);counter=0; },1000);
// then...
changeInterval(i,5);
changeInterval(i,2);
changeInterval(i,1);
changeInterval(i,0.5);
and it'll show you how many times per second it's actually been able to manage.
At the moment you're limited to about 4.5kHz = 0.22ms for simple functions like that example. The more complicated the function the slower it is though.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi MikeD,
The timer Espruino uses at the moment is the 32kHz RTC, so while theoretically you could do that, you're limited by the speed of execution. You can test with:
and it'll show you how many times per second it's actually been able to manage.
At the moment you're limited to about 4.5kHz = 0.22ms for simple functions like that example. The more complicated the function the slower it is though.