Beispiel #1
0
        public MotorLocator(IGpioPin clearCounter, IMotorInformation motorInformation)
        {
            stepCounter       = motorInformation.SteppingPin;
            clearCounterPin   = clearCounter;
            motorInfo         = motorInformation;
            position          = 0;
            lastMoveDirection = MoveDirection.Stopped;

            stepCounter.ValueChanged += pinValueChanged;
        }
Beispiel #2
0
        public MotorCalibrator(int gridMinValue, int gridMaxValue
                               , IMotorMover motorMover, IMotorInformation motorInformation
                               , IPhotoInterrupter topInterrupter, IPhotoInterrupter bottomInterrupter)
        {
            gridMin = gridMinValue;
            gridMax = gridMaxValue;

            locator   = motorMover.Locator;
            mover     = motorMover;
            motorInfo = motorInformation;
            top       = topInterrupter;
            bottom    = bottomInterrupter;

            top.ValueChanged    += topInterruptDetected;
            bottom.ValueChanged += bottomInterruptDetected;

            // Estimate the steps per grid unit
            StepsPerGridUnit = (float)(top.StepPosition - bottom.StepPosition) / (top.GridPosition - bottom.GridPosition);
            State            = CalibrationState.NeedsCalibrating;
        }