From the course: Learning Arduino: Interfacing with Analog Devices
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Coding using the Stepper() function - Arduino Tutorial
From the course: Learning Arduino: Interfacing with Analog Devices
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Stepper motor introduction2m 5s
-
(Locked)
Unipolar stepper motors1m 32s
-
(Locked)
Stepper motor driver board ULN200356s
-
(Locked)
Wiring a stepper motor to Arduino1m 49s
-
(Locked)
Coding to control the motor directly4m
-
(Locked)
Exploring the Stepper Library3m 55s
-
(Locked)
Coding for the stepper motor3m 20s
-
(Locked)
Coding using the Stepper() function4m 51s
-
(Locked)
-
-