Ejemplo n.º 1
0
 public void ActivateOrHold(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.ActivateOrHoldMotor, (byte)motors });
     }
 }
Ejemplo n.º 2
0
 public void StartContinuousRotation(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.StartContinuousRotation, (byte)motors });
     }
 }
Ejemplo n.º 3
0
 public void TurnOff(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.TurnOffMotor, (byte)motors });
     }
 }
Ejemplo n.º 4
0
 public void SetRotatingDirection(MotorSelection motors, RotatingDirection direction)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.SetRotationDirection, (byte)motors, (byte)direction });
     }
 }
Ejemplo n.º 5
0
 public void SetSpeedAndAcceleration(MotorSelection motors, SpeedSetting speed, Acceleration acceleration)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.SetSpeedAndAcceleration, (byte)motors, (byte)speed, (byte)acceleration });
     }
 }
Ejemplo n.º 6
0
 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 });
     }
 }
Ejemplo n.º 7
0
 public void RotateSteps(MotorSelection motors, uint steps)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.RotateNumberOfSteps, (byte)motors, (byte)(steps & 0x00FF), (byte)((steps & 0xFF00) >> 8) });
     }
 }
Ejemplo n.º 8
0
 public void ResetStepCounter(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.ResetStepCounter, (byte)motors });
     }
 }
Ejemplo n.º 9
0
 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;
     }
 }
Ejemplo n.º 10
0
 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;
     }
 }