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