Section 8: FastAccelStepper Setup

You are viewing Section 8 of 13

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.

engine.init();
stepper = engine.stepperConnectToPin(STEP_PIN);

Go to the documentation here to learn more.

We will get into more detail later.

 

NEXT SECTION: Section 9

 

Course Sections:

Leave a comment