예제 #1
0
        public async Task SendStepperStep(byte deviceNumber, byte direction, uint steps, short speed, short acceleration, StepperComplete completion, StepperProgress progress)
        {
            byte[] commandBuffer =
            {
                (byte)SysEx.Start,
                (byte)SysEx.StepperCommand,
                (byte)StepperCommand.Step,
                deviceNumber,
                direction,
                (byte)(steps & 0x7F),
                (byte)((steps >> 7) & 0x7F),
                (byte)((steps >> 14) & 0x7F),
                (byte)(speed & 0x7F),
                (byte)((speed >> 7) & 0x7F),
                (byte)(acceleration & 0x7F),
                (byte)((acceleration >> 7) & 0x7F),
                (byte)(acceleration & 0x7F),            // For our purposes, acceleration and deceleration are equal.
                (byte)((acceleration >> 7) & 0x7F),
                (byte)SysEx.End
            };

            stepperComplete[deviceNumber] = completion;
            stepperProgress[deviceNumber] = progress;

            await WriteData(commandBuffer);
        }
예제 #2
0
        public async Task SendStepperStep(byte deviceNumber, byte direction, uint steps, short speed, short acceleration, StepperComplete completion, StepperProgress progress)
        {
            byte[] commandBuffer =
            {
                (byte)SysEx.Start,
                (byte)SysEx.StepperCommand,
                (byte)StepperCommand.Step,
                deviceNumber,
                direction,
                (byte)(steps & 0x7F),
                (byte)((steps >> 7) & 0x7F),
                (byte)((steps >> 14) & 0x7F),
                (byte)(speed & 0x7F),
                (byte)((speed >> 7) & 0x7F),
                (byte)(acceleration & 0x7F),
                (byte)((acceleration >> 7) & 0x7F),
                (byte)(acceleration & 0x7F),            // For our purposes, acceleration and deceleration are equal.
                (byte)((acceleration >> 7) & 0x7F),
                (byte)SysEx.End
            };

            stepperComplete[deviceNumber] = completion;
            stepperProgress[deviceNumber] = progress;

            await WriteData(commandBuffer);
        }