Appendix A. Arduino Code Reference

analogRead

Gets the voltage value of a particular analog input pin. The values range from 0 to 1023, which represents the voltages 0 to 5. See Analog Input.

Warning

If the IOREF jumper is set to 3.3V, then the maximum input voltage for the analog input pins is 3.3 volts. However, this will not adjust the scale of analogRead(), which will always be based on 0 to 5 volts.

Syntax

analogRead(pin);

Parameters

pin
The pin number

Return value

integer (between 0 and 1023, representing 0 to 5 volts)

Example

int sensorReading = analogRead(0);

Gets the value from analog pin 0 and stores it in a new integer variable called sensorReading.

analogReadResolution

Sets the resolution of the value returned by analogRead(). Galileo’s analog-to-digital ...

Get Getting Started with Intel Galileo now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.