Main Content


Check if terminal can be used as a digital pin

Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.



result = isTerminalDigital(arduinoObj, terminal) checks if the specified terminal on the Arduino® board can be used a digital pin.


collapse all

Check if terminal 2 on your Arduino Uno hardware can be used as a digital pin.

arduinoObj = obj.Parent
result = isTerminalDigital(arduinoObj, 2)
result = 

Check if analog pin on your Arduino Leonardo can be used as digital pin. It is useful if you have multipurpose pins.

Create an arduino object, and get terminal number from analog pin A6.

arduinoObj = obj.Parent
getTerminalsFromPins(obj, 'A6')
ans =


Check if the terminal can be used as a digital pin.

result = isTerminalDigital(obj, 4)
result = 

Input Arguments

collapse all

Arduino object, specified as an object that is an internal variable called from within classes that derive from matlabshared.addon.LibraryBase.

Terminal number on Arduino hardware, specified as a double. For more information on terminal and pin numbers, see Physical Terminals and Pin Numbers.

Output Arguments

collapse all

Terminal type, returned as a boolean to indicate if terminal is digital

Version History

Introduced in R2015b