O'Reilly logo

Getting Started with Intel Galileo by Matt Richardson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required