dutyCycle property

  1. @override
void dutyCycle=(int percentOn)
override

Sets the percent of time that the GPIO pin is on/high/true, where 0 is off/low/false all of the time and 100 is on/high/true all of the time.

Implementation

@override
set dutyCycle(int percentOn) {
  if (percentOn >= 100) {
    gpio._sendPort.send(comm.writeCmd(bcmGpioPin, true));
  } else if (percentOn > 0) {
    gpio._sendPort.send(comm.setPwmCmd(bcmGpioPin, percentOn));
  } else {
    gpio._sendPort.send(comm.writeCmd(bcmGpioPin, false));
  }
}