Stepper Motor Control DRV8825

I am getting an "undefined reference to stepperRotate(float, float)" error when running this code:

const int stepPin = 2;
const int dirPin = 3;
const float motorAngle = 1.8;
const float stepSize = 0.5;

void stepperRotate(float rotation, float rpm);

void setup() {
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);


void loop() {
stepperRotate(1, 100);

How can I fix this? It seems to run fine from this reference - Stepper Motor Drivers with Arduino CODE - DRV8825 - YouTube

Thanks in advance for any help.

The code in the video contains a lot more than you have here. Your code contains the prototype* for stepperRotate() in the line just above setup() but you don't have the function itself.

There's a link in that youtube that takes you to the code where you will see the function just below loop().

*at least I think it's called a prototype, I never use them, since the IDE doesn't insist on them and afaik takes care of the lack thereof under the hood

Prototype is the correct name and the IDE does generate them behind the scenes. However, this sometimes can cause bizarre compilation errors when that prototype generation process goes awry.

Great, thanks. I did not know the "prototype" code could cause compilation errors down the road.

I got the stepper motor running off of the code from the YouTube video, but I am now looking for code that will last and not lead to compilation errors later. Can you please write the same code but in a way that won't lead to errors later?

Please see reply below and see if you could help. I would greatly appreciate any help I can get on this.