: currmode = configurePinResource (ar, pin)
: configurePinResource (ar, pin, owner, mode)
: configurePinResource (ar, pin, owner, mode, force)

Set/Get pin mode for a specified pin on arduino connection.

configurePinResource (ar, pin) will get the current mode of the specified pin.

configurePinResource (ar, pin, owner, mode) will attempt set the pin to the specified mode and owner.

If the pin is already owned by another owner, the configure will fail unless the force option is used. If the mode is already set, configure will fail unless force is used.

Inputs

ar - the arduino object of the connection to an arduino board.

pin - string name of the pin to set/get the mode of.

mode - string mode to set the pin to.

owner - string name to use as the pin owner.

force - boolean to force mode change. If not set, it will be false.

Outputs

currmode - current string mode of the pin.

Valid modes can be:

  • AnalogInput - Acquire analog signals from pin
  • DigitalInput - Acquire digital signals from pin
  • DigitalOutput - Generate digital signals from pin
  • I2C - Specify a pin to use with I2C protocol
  • Pullup - Specify pin to use a pullup switch
  • PWM - Specify pin to use a pulse width modulator
  • Servo - Specify pin to use a servo
  • SPI - Specify a pin to use with SPI protocol
  • Interrupt - Specify a pin to use with interrupts
  • Reserved - Pin marked reserved, but not for of any particular mode
  • Unset - Clears pin designation. The pin is no longer reserved and can be automatically set at the next operation.

See also: arduino, configurePin.

Package: arduino