: currmode = configurePin (ar, pin)
: configurePin (ar, pin, mode)

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

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

configurePin (ar, pin, mode) will attempt set the pin to the specified mode if the mode is unset.

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.

Outputs

mode - string current 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 for with interrupts
  • Reserved - Specify a pin to be reserved
  • Unset - Clears pin designation. The pin is no longer reserved and can be automatically set at the next operation.

See also: arduino.

Package: arduino