Ahh, well what you'd want to do with setInterval is something like this:
setInterval(function() { digitalWrite(pin,1); setTimeout(function() { digitalWrite(pin,0); }, 2); // 2ms @ 100Hz = 20% }, 10); // 100 Hz
(So you use a setInterval for each full cycle, and then setTimeout for each pulse)
Or you could use the built-in digitalPulse:
digitalPulse
setInterval(function() { digitalPulse(pin,1,2); // 2ms @ 100Hz = 20% }, 10); // 100 Hz
Hopefully those should work on anything
@Gordon started
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.
Ahh, well what you'd want to do with setInterval is something like this:
(So you use a setInterval for each full cycle, and then setTimeout for each pulse)
Or you could use the built-in
digitalPulse
:Hopefully those should work on anything