From the course: Learning Arduino: Interfacing with Analog Devices

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Coding for the stepper motor

Coding for the stepper motor - Arduino Tutorial

From the course: Learning Arduino: Interfacing with Analog Devices

Start my 1-month free trial

Coding for the stepper motor

- Alright so we are going to keep the same ordering that we had from our previous example. This time, when we do the coding, we are going to use the stepper library and using the stepper functions. Go ahead and click on file, Example, stepper library, and then select one step at a time. Okay, so I'm going to use one of the built-in examples that comes in the stepper library. So I'll explain the code one at a time, so we understand what each function is doing. In line 21 we can see that we included the library every time that we use a specific library with Ardurino we need to include that at the top. In line 23 we have the steps per revolution. They have a number of 200. We can keep that number, or we can change it to the one of our stepper motor. So I'm going to go ahead and change the number to the number that we calculated, which is 32. In line 27, you can see this is the stepper function. In the stepper function, we have the number of steps, and then the sequence. The sequence is…

Contents