diff --git a/gpio/driver/driver.go b/gpio/driver/driver.go index 8bedb54..bf9d3cf 100644 --- a/gpio/driver/driver.go +++ b/gpio/driver/driver.go @@ -33,6 +33,9 @@ type Conn interface { // GetValue gets the value of the pin. 0 for low values, 1 for high. GetValue(pin string) (int, error) + // SetPWMValue sets the value of the pin. Value must be in the range 0-255. + SetPWMValue(pin string, v int) error + // SetDirection sets the direction of the pin. SetDirection(pin string, dir Direction) error diff --git a/gpio/gpio.go b/gpio/gpio.go index 36c4527..71240f6 100644 --- a/gpio/gpio.go +++ b/gpio/gpio.go @@ -56,6 +56,11 @@ func (d *Device) GetValue(pin string) (int, error) { return d.conn.GetValue(pin) } +// SetPWMValue sets the value of the pin. Value must be in range 0-255. +func (d *Device) SetPWMValue(pin string, v int) error { + return d.conn.SetPWMValue(pin, v) +} + // SetDirection configures the direction of the pin. func (d *Device) SetDirection(pin string, dir Direction) error { return d.conn.SetDirection(pin, driver.Direction(dir))