Ejemplo n.º 1
0
        public void AddQueue(float interval, int direction)
        {
            var command = new A10PistonCommand();

            command.interval  = interval;
            command.direction = direction;
            commandQueue.Enqueue(command);
        }
Ejemplo n.º 2
0
        public static void AddQueue(float interval, int direction)
        {
            Console.WriteLine("AddQueue interval: {interval}, direction: {direction}");
            var command = new A10PistonCommand();

            command.interval  = interval;
            command.direction = direction * -1;
            commandQueue.Enqueue(command);
        }
Ejemplo n.º 3
0
        private static void PublishCommnand(A10PistonCommand command)
        {
            // 10-60 (The closer to 0, the slower.)
            //
            // 10 or more recommended.
            // Is less than 10 not recommended, the burden on the motor is very heavy
            //
            byte speed = ResolveSpeed(command.interval, command.direction);

            // 0-200 (Front is 0.)
            //
            byte position = (byte)(command.direction > 0 ? 200 : 0);

            Console.WriteLine($"onPublish speed: {speed}, positon: {position}");

            port.Write(new byte[] { 3, position, speed }, 0, 3);
        }