Problems with xbee lib

I am trying to read digital inputs on an xbee with my fio. I ran the series 1 IO sample code and can only read the states of the pins when they are high. When the pins are low, isDigitalEnabled(i) retruns 0 and the loop never executes. anyone got any ideas here. All I need to do is read one pin.

here is the code

 * Copyright (c) 2009 Andrew Rapp. All rights reserved.
 * This file is part of XBee-Arduino.
 * XBee-Arduino is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * XBee-Arduino is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with XBee-Arduino.  If not, see <>.

#include <XBee.h>
#include <SoftwareSerial.h>

This example is for Series 1 XBee Radios only
Receives I/O samples from a remote radio with 16-bit addressing.
The remote radio must have IR > 0, at least one digital or analog input enabled
and DL set to the 16-bit address of the receiving XBee (the one connected to the Arduino).
This example uses the NewSoftSerial library to view the XBee communication.  I am using a 
Modern Device USB BUB board ( and viewing the output
with the Arduino Serial Monitor.    
You can obtain the NewSoftSerial library here

// Define NewSoftSerial TX/RX pins
// Connect Arduino pin 9 to TX of usb-serial device
uint8_t ssRX = 12;
// Connect Arduino pin 10 to RX of usb-serial device
uint8_t ssTX = 13;
// Remember to connect all devices to a common Ground: XBee, Arduino and USB-Serial device
SoftwareSerial nss(ssRX, ssTX);

XBee xbee = XBee();

Rx16IoSampleResponse ioSample = Rx16IoSampleResponse();
// 64-bit response is same except api id equals RX_64_IO_RESPONSE and returns a 64-bit address
//Rx64IoSampleResponse ioSample = Rx64IoSampleResponse();

void setup() { 
  // start soft serial

void loop() {
  //attempt to read a packet    

  if (xbee.getResponse().isAvailable()) {
    // got something

    if (xbee.getResponse().getApiId() == RX_16_IO_RESPONSE) {

      nss.print("Received I/O Sample from: ");
      nss.println(ioSample.getRemoteAddress16(), HEX);  

      nss.print("Sample size is ");
      nss.println(ioSample.getSampleSize(), DEC);

      if (ioSample.containsAnalog()) {
        nss.println("Sample contains analog data");

      if (ioSample.containsDigital()) {
        nss.println("Sample contains digtal data");
      for (int k = 0; k < ioSample.getSampleSize(); k++) {
        nss.print("Sample "); 
        nss.print(k + 1, DEC);   
        for (int i = 0; i <= 5; i++) {
          if (ioSample.isAnalogEnabled(i)) {
            nss.print("Analog (AI");
            nss.print(i, DEC);
            nss.print(") is ");
            nss.println(ioSample.getAnalog(i, k));  
        for (int i = 0; i <= 8; i++) {
           if (ioSample.isDigitalEnabled(i)) { //this is where it fails if the pin is low
            nss.print("Digtal (DI");
            nss.print(i, DEC);
            nss.print(") is ");
            nss.println(ioSample.isDigitalOn(i, k));
    else {
      nss.print("Expected I/O Sample, but got ");
      nss.print(xbee.getResponse().getApiId(), HEX);
  else if (xbee.getResponse().isError()) {
    nss.print("Error reading packet.  Error code: ");  

Have you configured that pin to be an input pin? By default, all pins are turned off.

yes I have configured the pins as inputs. I think there might be some problem where the library parses the digital mask out of the io packet.

found the fix here