public void ActivateOrHold(MotorSelection motors) { lock (this) { SendCommand(new byte[] { (byte)RNCommands.ActivateOrHoldMotor, (byte)motors }); } }
public void StartContinuousRotation(MotorSelection motors) { lock (this) { SendCommand(new byte[] { (byte)RNCommands.StartContinuousRotation, (byte)motors }); } }
public void TurnOff(MotorSelection motors) { lock (this) { SendCommand(new byte[] { (byte)RNCommands.TurnOffMotor, (byte)motors }); } }
public void SetRotatingDirection(MotorSelection motors, RotatingDirection direction) { lock (this) { SendCommand(new byte[] { (byte)RNCommands.SetRotationDirection, (byte)motors, (byte)direction }); } }
public void SetSpeedAndAcceleration(MotorSelection motors, SpeedSetting speed, Acceleration acceleration) { lock (this) { SendCommand(new byte[] { (byte)RNCommands.SetSpeedAndAcceleration, (byte)motors, (byte)speed, (byte)acceleration }); } }
public void SetCurrent(CurrentSelection current, MotorSelection motors, uint mA, SettingsDuration duration = SettingsDuration.UntilReset) { lock (this) { SendCommand(new byte[] { (byte)current, (byte)motors, (byte)(mA & 0x00FF), (byte)((mA & 0xFF00) >> 8), (byte)duration }); } }
public void RotateSteps(MotorSelection motors, uint steps) { lock (this) { SendCommand(new byte[] { (byte)RNCommands.RotateNumberOfSteps, (byte)motors, (byte)(steps & 0x00FF), (byte)((steps & 0xFF00) >> 8) }); } }
public void ResetStepCounter(MotorSelection motors) { lock (this) { SendCommand(new byte[] { (byte)RNCommands.ResetStepCounter, (byte)motors }); } }
public uint[] GetStepCounter(MotorSelection motors) { lock (this) { byte[] answer = SendCommand(new byte[] { (byte)RNCommands.GetStepCounter, (byte)motors }); uint[] steps = new uint[answer.Length / 4]; for (int i = 0; i < answer.Length / 4; ++i) { steps[i] = 0; for (int j = 0; j < 4; ++j) steps[i] += answer[i * 4 + j] * (uint)Math.Pow(256, j); } return steps; } }
public MotorState[] GetMotorState(MotorSelection motors) { lock (this) { byte[] answer = SendCommand(new byte[] { (byte)RNCommands.GetMotorState }); MotorState[] states = new MotorState[answer.Length]; for (int i = 0; i < answer.Length; ++i) states[i] = (MotorState)answer[i]; return states; } }