Code Monkey home page Code Monkey logo

Comments (2)

golemparts avatar golemparts commented on June 7, 2024 1

Sure! I think the examples in the examples directory can probably help you out.

Hardware PWM servo example: https://github.com/golemparts/rppal/blob/master/examples/pwm_servo.rs
Software-based PWM servo example: https://github.com/golemparts/rppal/blob/master/examples/gpio_servo_softpwm.rs

While both hardware and software-based PWM will work, software-based PWM is inherently inaccurate on a multi-threaded OS due to scheduling/preemption. If you only need up to two PWM channels, I recommend just sticking with hardware PWM.

Be careful when hooking up a servo to your Pi. If you power your servo directly from the Pi's 5 V output, a current spike caused by the servo starting up or stalling could best case temporarily blow the polyfuse, worst case permanently damage your Pi. Most 9g micro servos are probably safe enough if you only connect a single servo, but definitely check its maximum ratings in the datasheet, or use an external power supply (connect the grounds together) to be safe. You'll also need to connect the control signal line to the relevant PWM pin.

from rppal.

jens1o avatar jens1o commented on June 7, 2024

Oh, I'm so sorry that I didn't looked into the example folder. I'm feeling so terribly stupid now.

Your reply is really what I was looking for.

I'll use an external power supply, just in case. Thanks for the heads up!

Thank you so much!

from rppal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.