I use function() instead of ()=>, because it doesn't work in my browser. And to stop analogWrite, use digatalRead.
// sinus.js //setInterval( ()=> {analogWrite(D2, (Math.sin(getTime()) / 2.01) + 0.5 );},10); //setInterval( function() {analogWrite(D2, (Math.sin(getTime()) / 2.001) + 0.5 );},10); analogWrite(D2, 0.5, {freq:1000}); //setTimeout(function() {analogWrite(D2, 0);},1700); setTimeout(function() {digitalRead(D2);},10);
@Frida 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.
I use function() instead of ()=>, because it doesn't work in my browser.
And to stop analogWrite, use digatalRead.