Main Content

validatePin

Validate that pin supports specific functionality

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

Description

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

example

Examples

collapse all

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

arduinoObj = obj.Parent;
validatePin(arduinoObj,'D12','SPI')

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

arduinoObj = obj.Parent;
validatePin(arduinoObj,'A4,'I2C')

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