Main Content


Validate that pin supports specific functionality

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



validatePin(arduinoObj, pin, type) validates specific functionality on the pin and throws an error if not supported.


collapse all

Check if pin D12 supports SPI functionality on the Arduino® Uno hardware.

arduinoObj = obj.Parent;

Only pins A4 and A5 support I2C type, the function returns an error for unsupported pins

arduinoObj = obj.Parent;

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.

Pin on Arduino hardware, specified as a character vector.

Pin type on Arduino hardware, specified as a character vector. Valid type values are:

  • 'I2C'

  • 'SPI'

  • 'PWM'

  • 'Servo'

  • 'analog'

  • 'digital'

Version History

Introduced in R2014b