コード例 #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;
            }
        }
コード例 #2
0
 public void AllStop()
 {
     Log.Info("All stop");
     Led0.Off();
     DcMotor.Stop();
 }