This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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