One use of an Arduino microcontroller is to collect data from sensors. Some of those
sensors are “analog”, i.e., their output ranges over a span of values, rather than
HIGH. Examples of such devices are thermometers, potentiometers,
light sensors, …
The input from these sensors can only be read on certain ports of the Arduino, labelled
A5. Input on those ports is automatically scaled by the microcontroller
to a range from 0 through 512. So, if the sensor produces a 5V signal, that is interpreted
512 by the Arduino, and if the sensor produces a 2.5V signal, that is interpreted
256 by the Arduino.
These readings can be used to trigger some other event (e.g., if the temperature exceeds
some value, then turn on an LED). They can also be viewed directly; this is often
useful for debugging purposes.
The Arduino IDE provides two ways to read the output of a sensor: text and graphics.
The example below show how much more effective the graphical output is for illustrating
trends in data. They both show the input from the analog port
A0 over a 10 second
|Reading analog input on the Serial Console||Viewing analog input on the Serial Plotter|
The packets on Simple Output to the Console and
Fancy Output to the Console showed how to display numbers on the
Serial Console. This packet shows you how to plot data from 1 or more inputs on the
Note: you can only use the Serial Console or the Serial Plotter at any one time.
To open the Console, either push the magnifier-glass button on the upper right of
the IDE, or use your mouse to select
To open the Plotter, use your mouse to select
Choosing either one causes the microcontroller to