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 to read the temperature sensor - Arduino Tutorial
From the course: Learning Arduino: Interfacing with Analog Devices
Coding to read the temperature sensor
- [Instructor] Go ahead and open a new file to start coding for the temperature sensor that we have. The very first thing that I need to do, is I need to initialize where is this analog sensor connected to. I'll go ahead and I'll put in an integer value: "analogPin", (keyboard sounds) and that is connected to A0. And I'll create two variables- float variables (keyboard sounds) for voltage out and one for the temperature. (keyboard sounds) The second thing that I need to do is go to the void setup and initialize the serial begin. Now there is a code within Arduino to specify the analog reference for the temperature sensor that we're using. If you go to the website, there is the command that's called "analogReference" and there are different ways that you can implement the analog reference. For our case, We need to specify that the maximum voltage, that we've received from the analog sensor, is 5 volts. In our case, We are going to use a default. There are many other ways that you can…
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
-
-
-
-
-