From the course: Learning Arduino: Interfacing with Analog Devices
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Coding to control the motor directly - Arduino Tutorial
From the course: Learning Arduino: Interfacing with Analog Devices
Coding to control the motor directly
- [Instructor] So there are two ways to driver the stepper motor. One is by using a built-in function with an Arduino, and the other one is by energizing each phase at a time manually. I'll start with the energizing each phase manually, and then we'll talk about the function in the next few videos. So, the very first thing I'm going to do is I'm going to initialize each input from the motor driver, so it's an integer motor pin one that was connected to digital pin eight in the Arduino board. I'm just going to go ahead and copy the same code, and then I'll be changing the second one to be a nine, the third one is connected to 10, and then finally the fourth one was connected to 11. Okay. I'm going to initialize the delay time here, so I'm going to go with integer delay time to be two, for example, and then we'll change that later in the code. In the void setup I'm going to set the pin mode for each of the motor pins to be as an output. So, pin mode for motor pin one is output, and I'll…
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)
-
-