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 the joystick and motor - Arduino Tutorial
From the course: Learning Arduino: Interfacing with Analog Devices
Coding the joystick and motor
- [Instructor] For the coding for this project, I provided a starter file, so go ahead, please, and open the starter file for Joystick and Stepper Motor for this section, and I'll walk through the code with you. So in line one, we're including the library. So in line number three we have the Stepper function, wherein the Stepper function we have the number of steps per revolution, which is 32 for our stepper motor. And then number two, four, three, five are the digital pins that we're connecting from the motor driver. Remember, the sequence is we're going with one, three, two, four. In line five, I initialize an xPin where we connect the input from the x-axis from the Joystick into A0. In line six, I have a variable that we store the values that we get from the analog input into a variable named xValue. For the y-axis, I initialize a variable named yPin where we connect the input that we have from the y-axis that's coming from analog input one. And then for the z-axis, it's a digital…
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)
Using the joystick to control LEDs51s
-
(Locked)
Wiring up the joystick and LEDs32s
-
(Locked)
Coding for the joystick and LEDs6m 17s
-
(Locked)
Using an LDR sensor to control a motor21s
-
(Locked)
Wiring41s
-
(Locked)
Coding the LDR and sensor4m 9s
-
(Locked)
Using a joystick to control a motor49s
-
(Locked)
Wiring up the joystick and motor37s
-
(Locked)
Coding the joystick and motor5m 48s
-
(Locked)
-