1

Is there any low-level hardware PWM driver (such as RPIO.PWM or ServoBlaster) that is written in Python or C++ or Java (Python or Java preferred) and is compatible with the Raspberry Pi 2 model B?

1 Answer 1

3

RPIO PWM (Python) has not been updated for the Pi2.

ServoBlaster (C) and some of its clones work on the Pi2.

pigpio (C, Python, command line) works on the Pi2.

ServoBlaster is controlled via its pipe interface (which means it can only be controlled locally).

pigpio may be controlled via its pipe interface, via its socket interface, or by direct link to the C library.

The pipe interface may be the simplest approach from Java, as the commands are issued by writing to a file.

E.g. pigpio exposes a pipe at /dev/pigpio once the daemon is started with sudo pigpiod.

To start 50% dutycycle PWM on GPIO 4 you write p 4 128\n to the pipe (without the newline (\n) the command would be buffered until a later command with newline is sent or the file is closed).

From the command line

echo "p 4 128" >/dev/pigpio

ServoBlaster and clones have a very similar interface.

1
  • 1
    Thanks! This is exactly what I looked for. Your pigpio is very well documented, keep up the good work!
    – Peter Zhu
    Dec 30, 2015 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.