Error when trying to drive 360° servo #5026
Replies: 1 comment
-
Posted at 2021-11-17 by @gfwilliams I think likely what happens is the digitalPulse in servo causes an exception which stops the next command executing which in turn causes the interval to keep on being called. Unminified source is at : http://www.espruino.com/modules/servo.js Is that literally all the code you have there? because I'd only expect that error if you were calling Posted at 2021-11-17 by Andreas_Rozek indeed, that's all my code - I just wanted to "quickly" test a servo (but nothing works quickly if I am touching it - I tend to break everything) Amendment: I also just checked the firmware state (just to be sure): and, yes, it is 2v10 Amendment 2: just to be sure, I flashed 2v10 one more time and tried my code again - with the same result. Posted at 2021-11-17 by Andreas_Rozek I just looked into the code you referenced - and I found a potential problem:
Shouldn't you always Amendment: I found the mistake - if a callback is given, If you like, you may change the beginning of your
At least, you should protect the Posted at 2021-11-17 by Andreas_Rozek I changed your code a bit, and now everything works as foreseen. Here is my complete test
Since you Posted at 2021-11-25 by @gfwilliams Sorry - missed this! So it did work ok, but it was just the usage of The Posted at 2021-11-25 by Andreas_Rozek Well, the primary problem was that I passed my
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-11-17 by Andreas_Rozek
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 endlesslyBeta Was this translation helpful? Give feedback.
All reactions