I just tried to drive an SG90 Micro Servo with 360° gear from an Original Espruino, wired to pin C7 (as the example suggests) - { range:2 } was the outcome of another test with an "ordinary" SG90.
var Servo = require('servo').connect(C7, { range:2 });
let Count = 0;
function move () {
if (Count < 10) {
Count++;
Servo.move(1, move);
}
}
move();
However, when uploading this code from the Web IDE it leads to an endless loop of error messages (and finally crashes the Chrome browser):
Uncaught Error: Pulse Time given for digitalPulse is less than 0, or not a number
at line 1 col 87
...Pulse(l,1,g+E.clip(b,0,1)*e);c+=1E3/(20*f)
^
in function called from system
...
Does this code try to recursively call Servo.move rather than my function move? But why does it then lead to an endless loop?
Amendment: renaming my function move to moveServo still loops endlessly
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 just tried to drive an SG90 Micro Servo with 360° gear from an Original Espruino, wired to pin C7 (as the example suggests) -
{ range:2 }
was the outcome of another test with an "ordinary" SG90.However, when uploading this code from the Web IDE it leads to an endless loop of error messages (and finally crashes the Chrome browser):
Does this code try to recursively call
Servo.move
rather than my functionmove
? But why does it then lead to an endless loop?Amendment: renaming my function
move
tomoveServo
still loops endlessly