8000 PWM does not work for Pi4J 2.0 - Why? · Issue #37 · Pi4J/pi4j · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
PWM does not work for Pi4J 2.0 - Why? #37
Open
@DanielMartensson

Description

@DanielMartensson

Hi!

I'm doing PWM but I cannot see any PWM signal when I try to connect.

I'm set the duty cycle the PWM with
pwm0.setDutyCycle(do0/ControlView.MAX_SLIDER_VALE);

https://github.com/DanielMartensson/OpenSourceLogger/blob/master/src/main/java/se/danielmartensson/threads/ControlThread.java

And the PWM decleration looks like this:

// This will turn on/off the FQP30N06L MOSFET
	private Pwm createDigitalPWMOutput(int pinOutput, Context pi4j, String id) {
        try {
            // use try-with-resources to auto-close I2C when complete
        	PwmConfig config = Pwm.newConfigBuilder(pi4j)
                    .id(id)
                    .name("PWM Pin output")
                    .address(pinOutput)
                    .pwmType(PwmType.SOFTWARE)
                    .frequency(pwmFrequency)   // optionally pre-configure the desired frequency to 1KHz
                    .dutyCycle(0)     // optionally pre-configure the desired duty-cycle (50%)
                    .shutdown(0)       // optionally pre-configure a shutdown duty-cycle value (on terminate)
                    .initial(0)     // optionally pre-configure an initial duty-cycle value (on startup)
                    .build();
        	Pwm pwm = pi4j.providers().get(PiGpioPwmProvider.class).create(config);
        	pwm.on();
			return pwm;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

https://github.com/DanielMartensson/OpenSourceLogger/blob/master/src/main/java/se/danielmartensson/pi4j/IO.java

The pwmFrequency is 100

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0