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.

readDigitalPin

Read data from digital pin on Arduino hardware

Syntax

value = readDigitalPin(a,pin)

Description

example

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

Examples

collapse all

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

a = arduino;
readDigitalPin(a,'D13')
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