From the course: Learning Arduino: Interfacing with Analog Devices

Unlock the full course today

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

Coding using the Stepper() function

Coding using the Stepper() function - Arduino Tutorial

From the course: Learning Arduino: Interfacing with Analog Devices

Start my 1-month free trial

Coding using the Stepper() function

- [Instructor] Okay, so I'm going to use another example that within the stepper motor library. I will make some adjustment according to our stepper motor to make it move a full revolution or half revolution, and to see the numbers that we need to put in. So, go ahead and click on File, Examples, Steppers, and then this time click on one revolution. All right, let's go through the code one at a time. Again, in line number 18, the first thing that you need to include when using any of the libraries within Arduino is to include the library at the top, and here we're using the stepper motor library. In line 20, we have the stepsPerRevolution to be 200. Now, if I want to change this to make it move a full revolution for our stepper motor, I'm going to explain what is the proper number that we need to put in here. Now, to find the number of steps to complete one revolution, we need to consider the gear ratio. The gear ratio, you find it from the data sheet. You can see here in the data…

Contents