public DCMotor(MotorHat hat, int index) { Hat = hat; Index = index; switch (index) { case 0: PWMPin = 8; In2Pin = 9; In1Pin = 10; break; case 1: PWMPin = 13; In2Pin = 12; In1Pin = 11; break; case 2: PWMPin = 2; In2Pin = 3; In1Pin = 4; break; case 3: PWMPin = 7; In2Pin = 6; In1Pin = 5; break; default: break; } }
public Stepper(MotorHat hat, ushort steps, int index) { Hat = hat; Index = index; RevSteps = steps; if (8 == MICROSTEPS) { MicrostepCurve = new List <int>() { 0, 50, 98, 142, 180, 212, 236, 250, 255 } } ; else { MicrostepCurve = new List <int>() { 0, 25, 50, 74, 98, 120, 141, 162, 180, 197, 212, 225, 236, 244, 250, 253, 255 } }; switch (index) { case 0: PWMAPin = 8; AIn2Pin = 9; AIn1Pin = 10; PWMBPin = 13; BIn2Pin = 12; BIn1Pin = 11; break; case 1: PWMAPin = 2; AIn2Pin = 3; AIn1Pin = 4; PWMBPin = 7; BIn2Pin = 6; BIn1Pin = 5; break; default: break; } }