Example #1
0
        public StepperMotor(ILogger logger, PwmDriverPCA9685 driver, int motorNr, int steps)
        {
            this.logger      = logger;
            this.driver      = driver;
            this.revsteps    = steps;
            this.currentstep = 0;
            this.syncDelay   = new SyncDelay();
            syncDelay.Calibrate();

            switch (motorNr)
            {
            case 1:
                this.pwmA = 8;
                this.ain2 = 9;
                this.ain1 = 10;
                this.pwmB = 13;
                this.bin2 = 12;
                this.bin1 = 11;
                break;

            case 2:
                this.pwmA = 2;
                this.ain2 = 3;
                this.ain1 = 4;
                this.pwmB = 7;
                this.bin2 = 6;
                this.bin1 = 5;
                break;

            default:
                throw new ArgumentOutOfRangeException("MotorHAT Stepper motor-Nr. must be between 1 and 2 inclusive");
            }
        }
        public StepperMotor(ILogger logger, PwmDriverPCA9685 driver, int motorNr, int steps)
        {
            this.logger = logger;
            this.driver = driver;
            this.revsteps = steps;
            this.currentstep = 0;
            this.syncDelay = new SyncDelay();
            syncDelay.Calibrate();

            switch (motorNr)
            {
                case 1:
                    this.pwmA = 8;
                    this.ain2 = 9;
                    this.ain1 = 10;
                    this.pwmB = 13;
                    this.bin2 = 12;
                    this.bin1 = 11;
                    break;
                case 2:
                    this.pwmA = 2;
                    this.ain2 = 3;
                    this.ain1 = 4;
                    this.pwmB = 7;
                    this.bin2 = 6;
                    this.bin1 = 5;
                    break;
                default:
                    throw new ArgumentOutOfRangeException("MotorHAT Stepper motor-Nr. must be between 1 and 2 inclusive");
            }
        }