Thanks guys. I tried following your advice to not use blocking code, but ran into another problem. I can't change that value of variables inside the function prototype. For example, this code works:
The result is that it moves to position 1.45 at time 1000. So I guess it has already run "pos -= posInc;" three times before it first calls the analogWrite() function.
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.
Thanks guys. I tried following your advice to not use blocking code, but ran into another problem. I can't change that value of variables inside the function prototype. For example, this code works:
But this code does not:
The result is that it moves to position 1.45 at time 1000. So I guess it has already run "pos -= posInc;" three times before it first calls the analogWrite() function.
Please help,
Rehman