Active project?

Robert Savage robert at savage7.com
Thu Nov 12 19:51:53 UTC 2015


Hi Jeff,

I tested PWM using Pi4J on a Raspberry Pi 2B today and it seems to be
working properly.

I tested the following hardware supported PWM pins on the RPi-2B:
http://pi4j.com/pins/model-2b-rev1.html

   - GPIO_01
   - GPIO_23
   - GPIO_24
   - GPIO_26

I tested on the following versions of Pi4J.

   - 1.0 (release)
   - 1.0.1-SNAPSHOT
   - 1.1-SNAPSHOT


The link below is a snapshot image of the oscilloscope output I used to
verify the PWM signal was present.
https://dl.dropboxusercontent.com/u/24688272/RPI2B-Pi4J-PWM-24.png

Thanks, Robert

On Thu, Nov 12, 2015 at 10:13 AM, Jeff Prestes <jeffprestes at gmail.com>
wrote:

> Hi All,
>
> Thanks for the answers.
>
> Robert, first, congratulations for your project. It helped me a lot. But
> regarding PWN, I am sorry but I've tried to run your code above in my
> RaspberryPis (B+ and 2) couple of months ago for my project Brasilino (
> https://github.com/jeffprestes/brasilino) and I couldn't control a servo
> motor like I do with Arduino. I believe it's not your code's fault but as
> Sergey said a lack of Linux functionality.
>
> Gerrit, I will try to see what possible workaround Michael has created for
> this. Thanks for sharing it.
>
> Best,
>
> -Jeff
>
> On Thu, Nov 12, 2015 at 6:47 AM, Robert Savage <robert at savage7.com> wrote:
>
>> Hi Jeff,
>>
>> You should be able to use PWM with Pi4J.
>>
>> Simple hardware PWM example:
>>
>> package gpio.test;
>>
>>
>> import com.pi4j.io.gpio.GpioController;
>> import com.pi4j.io.gpio.GpioFactory;
>> import com.pi4j.io.gpio.GpioPinPwmOutput;
>> import com.pi4j.io.gpio.RaspiPin;
>>
>>
>> public class PwmTest {
>>
>>    /**
>>      * @param args the command line arguments
>>      * @throws java.lang.InterruptedException
>>      */
>>     public static void main(String[] args) throws InterruptedException {
>>
>>         GpioController gpio = GpioFactory.getInstance();
>>         GpioPinPwmOutput pwm = gpio.provisionPwmOutputPin(RaspiPin.
>> GPIO_24);
>>         pwm.setPwm(500);
>>
>>         // keep program running until user aborts (CTRL-C)
>>         for (;;) { Thread.sleep(500); }
>>     }
>>
>> }
>>
>>
>> Thanks, Robert
>>
>> On Wed, Nov 11, 2015 at 11:55 PM, Jeff Prestes <jeffprestes at gmail.com>
>> wrote:
>>
>>> Hey Andrew,
>>>
>>> I've tried but using dio or Pi4J I couldn't simulate a PWM.
>>>
>>> Best,
>>>
>>> -Jeff
>>>
>>> On Wed, Nov 11, 2015 at 5:21 PM, Andrew Penhorwood <andrew at coldbits.com>
>>> wrote:
>>>
>>> > Is this project active?  I was hoping for some pointers on how to do
>>> PWM
>>> > with the raspberry PI.
>>> >
>>> > --
>>> > Andrew Penhorwood
>>> >
>>> >
>>>
>>
>>
>


More information about the dio-dev mailing list