Looks like i was wrong about soft:true, but I just had a quick look and you can get something working with the following:
soft:true
function t() { analogWrite(LED1,0.1+0.09*Math.sin(getTime()), {freq:100,forceSoft:true}); analogWrite(LED2,0.1+0.09*Math.sin(getTime()*1.2324), {freq:100,forceSoft:true}); analogWrite(LED3,0.1+0.09*Math.sin(getTime()*1.4634), {freq:100,forceSoft:true}); } setInterval(t, 50);
Looks like there's a glitch with multiple soft PWM when you give some a value of 0 though (hence the 0.1+0.09*x).
0.1+0.09*x
@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.
Looks like i was wrong about
soft:true
, but I just had a quick look and you can get something working with the following:Looks like there's a glitch with multiple soft PWM when you give some a value of 0 though (hence the
0.1+0.09*x
).