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 the joystick circuit - Arduino Tutorial
From the course: Learning Arduino: Interfacing with Analog Devices
Coding the joystick circuit
- Alright! So for the coding for the joystick, we are going to program a very simple code that shows the values that we read from each access. So, the very first thing again, we need to initialize what each pin is connected to. So integer xPin is connected to A0. (typing on computer) Integer yPin is connected to analog input one, and then, finally, the z axis. I'm going to just put it as a KeyPin that's connected to digital Pin eight. Alright. So now in the void setup I'm going to use the internal pull up resistor for the KeyPin which is, um, z axis. So, pinMode, and then the KeyPin (typing on computer) and then I'm going to use initialize it is an input and then activate the pull up resistor. (typing on computer) Okay. And then for the KeyPin, uh, since it's a switch it's either on and off, so I'm just going to write it as a high as a default and whenever I press on it, it changes to zero. So I'm just going to write digitalWrite KeyPin (typing on computer) and then it only shows it…
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
-
-
-
What are analog devices?2m 3s
-
Understanding analog-to-digital converters1m 50s
-
(Locked)
Exploring our temperature sensor (TMP37)2m 29s
-
(Locked)
Understanding how to interpret the sensor values2m 55s
-
(Locked)
Interpreting the sensor values1m 16s
-
(Locked)
Wiring up the temperature sensor57s
-
(Locked)
Coding to read the temperature sensor4m 56s
-
(Locked)
LDR (light-dependent resistor) sensor1m 36s
-
(Locked)
Using a voltage divider with our LDR3m 43s
-
Wiring up our LDR circuit1m 26s
-
(Locked)
Coding to read the LDR circuit3m 56s
-
(Locked)
Joystick module2m 9s
-
(Locked)
Wiring up our joystick1m 9s
-
(Locked)
Coding the joystick circuit4m 47s
-
-
-
-
-