Section 8: FastAccelStepper Setup
What is the FastAccelStepper library?
Did you know that we can actually drive the motor using digitalWrite to the Step pin? Stepper driver waits for a high signal on the step pin. When it sees a high pulse, it moves one step. Super simple!
Based on how fast you send a high pulse determines the speed that the motor turns.
The FastAccelStepper library is a set of algorithms that make controlling a motor very simple. We just tell it how far to move and how fast, and the library figures out how to pulse the step pin and sets the direction pin. This library will control the motor.
We are going to get in much deeper to this library very soon.
To start setting up the driver, we include the FastAccelStepper library.
Let’s Initialize FastAccelStepper on lines 39 and 40 of MotorControl.h
FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;
But it still needs to be initialized. For this init will be used on line 204 and 205.
stepper = engine.stepperConnectToPin(STEP_PIN);
Go to the documentation here to learn more.
We will get into more detail later.
- Section 0: Background
- Section 1: Hardware Setup
- Section 2: Stepper Motor Basics
- Section 3: Arduino Setup
- Section 4: Understanding Trinamic Drivers
- Section 5: Setting Trinamic Drivers
- Section 6: Power Requirements
- Section 7: StallGuard
- Section 8: FastAccelStepper Library
- Section 9: ESP32 Dual Core Setup
- Section 10: Motor Setup
- Section 11: Preferences Library
- Section 12: ESPUI
- Section 13: API