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.


Read data from digital pin on Arduino hardware


value = readDigitalPin(a,pin)



value = readDigitalPin(a,pin) reads data from the specified pin on the Arduino® hardware in connection a.


collapse all

Create a connection to Arduino hardware and read digital pin 13.

a = arduino;
ans = 1

Input Arguments

collapse all

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

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

Output Arguments

collapse all

Value acquired from digital pin, returned as a numeric double.

Introduced in R2014b