We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Can someone please help me?

  • So I'm trying to control a servo that my webcam sit's on..

    The servo I have "servo datasheet"

    I know your all saying use the pwm shield but I can't afford any shields as my transmission went out on my car and the car was less than the transmission replacement.

    So I'm using fast-gpio to send the pwm signals after reading this https://wiki.onion.io/Tutorials/Using-PWM-on-Exp-Dock

    function SweepLeft()
      exec("fast-gpio pwm 21 50 90 2>&1");
    function SweepRight()
      exec("fast-gpio pwm 21 50 0 2>&1");

    I have the servo pwm line to pin 21

    But the servo sounds like it's still moving and it twitches, also going right is a lot faster then going left.
    to stop the twitching sound once the servo is done moving I can do fast-gpio set 21 0 what the issue and how can I tell if the servo is done moving or not in the code?

  • administrators

    @Chris-McCaslin Try using any pins other than 20 and 21 since they run the I2C protocol.

    With regards to the servo, while fast-gpio is pretty handy, it's still software-based PWM. Anytime another process gets the CPU's full attention, the PWM signal will change. This will happen many times a second, so the PWM signal going to the servo will be constantly changing. This change in the PWM signal is the reason why your servo is twitching. Sorry, but your best bet for a non-twitchy servo is the Servo Expansion.

    Another thing, your servo accepts a high pulse of 1ms to 2ms in a 20ms PWM period.

    • For the farthest position in one direction you would send a signal that is 1ms high and 19ms low, meaning a 5% duty cycle
    • The farthest position in the other direction requires a signal that is 2ms high and 18ms low, so a 10% duty cycle
    • And the neutral position would be: 1.5ms high and 18.5ms low, so 7.5% duty cycle

Looks like your connection to Community was lost, please wait while we try to reconnect.