Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public void Command(int channel, int percent)
 {
     Servo.MoveTo(percent);
 }