I'm trying to control DC motors with L298N motor driver. I'm using Raspberry Pi 3B and java GUI called Processing. I can't find PWM libraries for software control or use hardware PWM because I need two PWM pins but Raspberry Pi has only one.

Any suggestions for libraries... or anything else?


The Pi has two hardware PWM channels.

Channel 0 may be fed to GPIO 12 and/or 18.

Channel 1 may be fed to GPIO 13 and/or 19.

GPIO 12/13/18/19 are brought out to all Pis with the 40-pin expansion header.

My pigpio library supports use of the hardware PWM pins as well as providing hardware timed PWM on all the GPIO (equally suitable for motor speed control).

I have no idea how easy it would be to integrate pigpio into your environment.

You mention Java. There is a Java library called Pi4J which might be suitable.

Your Answer

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

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