This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

readVoltage

Read voltage from analog pin on Arduino hardware

Syntax

voltage = readVoltage(a,pin)

Description

example

voltage = readVoltage(a,pin) reads the voltage on the specified analog input pins on Arduino® hardware.

Examples

collapse all

Create an Arduino object and read voltage from and analog input pin.

a = arduino;
readVoltage(a,'A4')
ans = 1.0606

Input Arguments

collapse all

Arduino hardware connection created using arduino, specified as an object.

Analog pin number on the physical hardware, specified as a character vector.

Output Arguments

collapse all

Voltage read from an analog pin on an Arduino hardware specified as a numeric double.

Introduced in R2014b