Sets the period and pulse width of PWM output signal.
func set(period: Int, pulse: Int)
s7SwiftIO6PWMOutC3set6period5pulseySi_SitF
2MUSW
The period of the PWM ouput signal in microsecond.
The pulse width in the PWM period, that is, the duration of high voltage in microsecond. This time can’t be longer than the period.
import SwiftIO
The SwiftIO library allows you to access and control the hardware in an easy way.
final class PWMOut
The PWMOut class is used to generate periodic square waves and modulate the pulse width to get different average output.
@frozen struct Int
A signed integer value type.
func set(frequency: Int, dutycycle: Float)
Sets the frequency and the dutycycle of PWM output signal.
func setDutycycle(_ dutycycle: Float)
Sets the percentage of time during a period in which the output is high, from 0.0 to 1.0
func suspend()
Suspends the PWM output.
func resume()
Continues the PWM output.
init(_ idName: Id, frequency: Int = 1000, dutycycle: Float = 0.0)
Initializes a PWM output with the specified frequency and dutycycle.
var maxFrequency: Int { get }
The max frequency of PWM output.
var minFrequency: Int { get }
The min frequency of PWM output.
let obj: UnsafeMutableRawPointer