public void Command(PwmCommand pwmCommand) { Log.DebugFormat("PwmCommand received({0})!", pwmCommand); switch (pwmCommand.Channel) { case DeviceChannel.DcMotor: var percent = pwmCommand.DutyCyclePercent; var direction = percent > 0 ? MotorDirection.Forward : MotorDirection.Reverse; DcMotor.Go(Math.Abs(percent), direction); break; case DeviceChannel.Led: Led0.On(pwmCommand.DutyCyclePercent); break; case DeviceChannel.Servo: Servo.MoveTo(pwmCommand.DutyCyclePercent); break; } }
public void Command(int channel, int percent) { Servo.MoveTo(percent); }