validatePin

Validate that pin supports specific functionality

Syntax

validatePin(arduinoObj, pin, type)

Description

example

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

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'

Introduced in R2014b