0
\$\begingroup\$

I'm playing with a BBC:micro using EspruinoJS and I'd like to control a couple of Feetec FS90R continuous rotation mini servos(datasheet pdf link).

I had no luck using digitalPulse and just moderate results with analogWrite:

analogWrite(D1,0.0295,{freq:20});

almost stops the continuous servo, at least a bit better than 0.3, although every once in a while it still turns for a bit.

analogWrite(D4,0.02,{freq:20});

and

analogWrite(D4,0.04,{freq:20});

turn the servo pretty fast CW/CCW as expected.

Other than the fact that I can't seem to reliably stop the servo, the other major problem I'm facing is that no other ADC pins seems to work:

>analogWrite(D0,0.0295,{freq:20});
Uncaught InternalError: Timeout on Utility Timer
 at line 1 col 32
analogWrite(D0,0.0295,{freq:20});
                               ^
>analogWrite(D2,0.0295,{freq:20});
Uncaught InternalError: Timeout on Utility Timer
 at line 1 col 32
analogWrite(D2,0.0295,{freq:20});
                               ^
>analogWrite(D3,0.0295,{freq:20});
Uncaught InternalError: Timeout on Utility Timer
 at line 1 col 32
analogWrite(D3,0.0295,{freq:20});
                               ^
>analogWrite(D4,0.0295,{freq:20});
Uncaught InternalError: Timeout on Utility Timer
 at line 1 col 32
analogWrite(D4,0.0295,{freq:20});
                               ^
>analogWrite(D10,0.0295,{freq:20});
Uncaught InternalError: Timeout on Utility Timer
 at line 1 col 33
analogWrite(D10,0.0295,{freq:20});
                                ^
>analogWrite(D11,0.0295,{freq:20});
Uncaught InternalError: Timeout on Utility Timer
 at line 1 col 33
analogWrite(D11,0.0295,{freq:20});
                                ^
>analogWrite(D19,0.0295,{freq:20});
Uncaught InternalError: Timeout on Utility Timer
 at line 1 col 33
analogWrite(D19,0.0295,{freq:20});

Normally I use MicroPython on micro:bit, but I'd like to use Espruino in this to be able to use Bluetooth to control the servos.

How can I drive two servo using Espruino on micro:bit ?

\$\endgroup\$
  • \$\begingroup\$ espruino.com/Servo+Motors#line=33 \$\endgroup\$ – Bruce Abbott Dec 11 '18 at 18:36
  • \$\begingroup\$ Being unable to decisively stop is a fundamental flaw in the crude hack that is a continuous rotation PWM command servo, and probably not a consequence of the way that you are generating the PWM. \$\endgroup\$ – Chris Stratton Dec 11 '18 at 18:41
  • \$\begingroup\$ Did you see this line about calibration on the datasheet: "They may require some simple calibration, simply tell the servo to 'stop' and then gently adjust the potentiometer in the recessed hole with a small screwdriver until the servo stops moving."? Could that be the cause of it not stopping? \$\endgroup\$ – Aerik Dec 12 '18 at 16:27
  • \$\begingroup\$ @BruceAbbott getting Uncaught Error: Function "clip" not found! at line 1 col 80 ...(1-d);digitalPulse(k,1,g+E.clip(c,0,1)*e);d+=1E3/(20*f) with the js servo module and still getting errors when using analogWrite on any other ADC pin except D1 \$\endgroup\$ – George Profenza Dec 12 '18 at 20:28
  • \$\begingroup\$ @Aerik Gave that little pot a go with a tiny screw driver but I somehow got it worse :))) Now it's twitching between back and forth: fun CW/CCW duel, but not quite what I was after. wish there was an undo button \$\endgroup\$ – George Profenza Dec 12 '18 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.