From the course: Learning Arduino: Pulse Width Modulation
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Understanding the basics of analog input - Arduino Tutorial
From the course: Learning Arduino: Pulse Width Modulation
Understanding the basics of analog input
- For this sketch, I'm going to use a potentiometer to adjust the value read on an analog input pin. I have one lead of the potentiometer connected to five volts, the other side to ground, and the center lead connected to analog input pin zero. In the Arduino IDE, I will select File, Examples, Basics, AnalogReadSerial. There are three lines of code in this sketch that may be new to you. First, in the setup function, we are initializing the serial monitor. This opens a serial communication port between the Arduino and your computer. The value of 9600 sets the maximum transfer rate of the serial port to 9600 bits per second. This is called the Baud rate, which defines how quickly information is transferred in a communication channel. A baud rate of 9600 allows 960 characters per second to be transferred. For most applications, this transfer rate is sufficient. The Arduino is capable of supporting baud rates up to 115,200, or 11,520 characters per second. Next, the Arduino will read the…
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
-
-
-
-
Introducing various analog inputs3m 52s
-
(Locked)
Understanding the basics of analog input3m 15s
-
(Locked)
Finding logic bugs in your code3m 40s
-
(Locked)
Testing components with a multimeter3m 31s
-
(Locked)
Using the map function3m 50s
-
(Locked)
Challenge: Understanding the math behind the map function49s
-
(Locked)
Solution: Understanding the math behind the map function1m 15s
-
-
-
-