All XBee device classes include the configuration method SetIOConfiguration(IOLine, IOMode), where you can specify the IO line being configured and the desired function being set.

Method Description

SetIOConfiguration(IOLine, IOMode)

Sets the configuration of the given IO line. Arguments are an item of the IOLine enumeration class (line to configure) and an item of the IOMode enumeration class (the mode to be set).
Available IOMode values are:

  • IOMode.DISABLED

  • IOMode.SPECIAL_FUNCTIONALITY (Shouldn’t be used to configure IOs)

  • IOMode.PWM

  • IOMode.ADC

  • IOMode.DIGITAL_IN

  • IOMode.DIGITAL_OUT_LOW

  • IOMode.DIGITAL_OUT_HIGH

The SetIOConfiguration(IOLine, IOMode) method may fail for the following reasons:

  • The IO line or IO mode arguments are unknown, throwing an ArgumentException.

  • The device is not connected, throwing an InterfaceNotOpenException.

  • There is a timeout sending the configuration command, throwing a TimeoutException.

  • Other errors are caught as XBeeException.

Configure IO lines
// Instantiate an XBee device object.
XBeeBLEDevice myXBeeBLEDevice = new XBeeBLEDevice("00:00:00:00:00:00", "password");

// Connect the device.
myXBeeBLEDevice.Connect();

// Configure the DIO1_AD1 line to be Digital output (set high by default).
myXBeeBLEDevice.SetIOConfiguration(IOLine.DIO1_AD1, IOMode.DIGITAL_OUT_HIGH);

// Configure the DIO2_AD2 line to be Digital input.
myXBeeBLEDevice.SetIOConfiguration(IOLine.DIO2_AD2, IOMode.DIGITAL_IN);

You can read the current configuration of any IO line the same way an IO line can be configured with a desired function using the corresponding getter, GetIOConfiguration(IOLine).

Method Description

GetIOConfiguration(IOLine)

Returns the configuration mode of the provided IO line. The parameter must be an item of the IOLine enumeration class (line to get its configuration). The returned value is an item of the IOMode enumeration class (the mode of the line).

The GetIOConfiguration(IOLine) method may fail for the following reasons:

  • The IO line argument is unknown, throwing an ArgumentException.

  • The device is not connected, throwing an InterfaceNotOpenException.

  • There is a timeout sending the configuration command, throwing a TimeoutException.

  • Other errors are caught as XBeeException.

Once an IO line is configured, you can set or read its value.