Characteristic Locus
Inheritance System.Object > SoftPwmPort
Namespace Meadow.Foundation.Generators
Assembly Meadow.Foundation.dll

Syntax

public class SoftPwmPort : IPwmPort

Constructors

SoftPwmPort(IDigitalOutputPort, Single, Single)

Instantiate a SoftPwm object that can perform PWM using digital pins

Declaration
public SoftPwmPort(IDigitalOutputPort outputPort, float dutyCycle = 0F, float frequencyInHertz = null)

Parameters

Type Name Description
IDigitalOutputPort outputPort
System.Single dutyCycle
System.Single frequencyInHertz

SoftPwmPort(IMeadowDevice, IPin, Single, Single)

Instantiate a SoftPwm object that can perform PWM using digital pins

Declaration
public SoftPwmPort(IMeadowDevice device, IPin outputPin, float dutyCycle = 0.5F, float frequency = 1F)

Parameters

Type Name Description
IMeadowDevice device
IPin outputPin
System.Single dutyCycle
System.Single frequency

Properties

Channel

Channel info for PWM port

Declaration
public IPwmChannelInfo Channel { get; protected set; }

Property Value

Type Description
IPwmChannelInfo

Duration

PWM duration in ms

Declaration
public float Duration { get; set; }

Property Value

Type Description
System.Single

DutyCycle

Duty cycle of PWM

Declaration
public float DutyCycle { get; set; }

Property Value

Type Description
System.Single

Frequency

Frequency of soft PWM

Declaration
public Frequency Frequency { get; set; }

Property Value

Type Description
Frequency

Inverted

Is the PWM signal inverted

Declaration
public bool Inverted { get; set; }

Property Value

Type Description
System.Boolean

Period

Period of PWM

Declaration
public float Period { get; set; }

Property Value

Type Description
System.Single

Pin

Pin used for soft PWM

Declaration
public IPin Pin { get; }

Property Value

Type Description
IPin

Port

Digital output port used for PWM

Declaration
protected IDigitalOutputPort Port { get; set; }

Property Value

Type Description
IDigitalOutputPort

State

State of PWM port (running / not running)

Declaration
public bool State { get; }

Property Value

Type Description
System.Boolean

TimeScale

Timescale

Declaration
public TimeScale TimeScale { get; set; }

Property Value

Type Description
TimeScale

Methods

CalculateOffTimeMillis()

Calculates the off time of pulse in milliseconds

Declaration
protected int CalculateOffTimeMillis()

Returns

Type Description
System.Int32

CalculateOnTimeMillis()

Calculates the pulse on time in milliseconds

Declaration
protected int CalculateOnTimeMillis()

Returns

Type Description
System.Int32

Dispose()

Dispose soft pwm port

Declaration
public void Dispose()

Dispose(Boolean)

Dispose soft PWM

Declaration
protected virtual void Dispose(bool disposing)

Parameters

Type Name Description
System.Boolean disposing

Start()

Start the pulse width modulation

Declaration
public void Start()

Stop()

Stop the pulse width modulation

Declaration
public void Stop()