the XBee blues; problem reading RSSI series 1 XBee pin

So i’ve got two sketches (big thanks to Jack Christensen for help with the code) that are suppose to send the RSSI value of one emitter xbee to a receiver.

The only parameters i’ve changed on the xbees through AT commands are the ID’s and the baud rate. serial communication is happening (I printed out a random number intentionally from the emitter to the receiver with success) but for some reason its not grabbing the incoming values from the RSSI pin. wiring is correct, commands match, etc.

** to note jack had tried this code on series 2 xbees with success. not sure what I am missing.

heres the code:

emitter :

// Daniel Jay Bertner - Bike communication modules
// Modified by Jack Christensen 10Nov2012

//Transmitter modules. These are the bike units intended to show signal strength indication in correlation to a central networked hub

//x bees have been configured with personal ID's to avoid interference with other networks (encryption).
//encryption is not about interference, just use a unique PAN ID (ATID) ... jc
//optimal xbee use is outdoors, no wall interference/metal(close contact). range is 300ft at optimal conditions. 
//

#define EMITTER_NBR 1                      //emitter number, set to 1 or 2
#define XBEE_BAUD_RATE 38400
#define XMIT_DELAY 200
#define RSSI_PIN 9                         //connect to the XBee RSSI pin (Daniel's wiring)
//#define RSSI_PIN 2                         //connect to the XBee RSSI pin (Jack's wiring)
const byte ledPins[] = { 3, 4, 5, 6, 7, 8, 10, 11, 12, 13 };    //Daniel's wiring
//const byte ledPins[] = { 12, 13, 6, 7, 8, 3, 4, 5, 9, 10};        //Jack's wiring
#define NBR_LEDS sizeof(ledPins) / sizeof(ledPins[0])

///Averager Variables///////////////////////////////
//this is intended to place first 10 read incoming RSSI values in an array and average. smoother readings

#define NBR_READINGS 10                    //number of readings to average
unsigned long pulseWidth;                  //the XBee RSSI pulse width reading from pulseIn
unsigned long readings[NBR_READINGS];      //RSSI readings
int index;                                 //index to current reading
unsigned long total;                       //total of the readings
unsigned long average;                     //average of the readings
boolean first = true;                      //first time flag to initialize readings array and total

///////////////////////////////////////////////////

void setup()
{
    Serial.begin(XBEE_BAUD_RATE);                   

    for (byte i=0; i<NBR_LEDS; i++)
        pinMode(ledPins[i], OUTPUT);
}

void loop()
{
    Serial.print('<');
    Serial.print(EMITTER_NBR, DEC);
    Serial.print('>');
    Serial.print(average, DEC);
    delay(50);        //allow time for transmission
    pulseWidth = pulseIn(RSSI_PIN, LOW, XMIT_DELAY/2);
    if (first) {
        first = false;
        total = pulseWidth * NBR_READINGS;
        for (int i=0; i<NBR_READINGS; i++)
            readings[i] = pulseWidth;
    }
    else {
        if (++index >= NBR_READINGS) index = 0;
        total = total - readings[index] + pulseWidth;
        readings[index] = pulseWidth;
    }
    average = total / NBR_READINGS;         
    runDisplay();
    delay(XMIT_DELAY - 50);
}
    
//run the bargraph display
void runDisplay(void)
{
    if (average < 10)
        light(10);
    else if (average < 20)
        light(9);
    else if (average < 30)
        light(8);
    else if (average < 40)
        light(7);
    else if (average < 50)
        light(6);
    else if (average < 60)
        light(5);
    else if (average < 70)
        light(4);
    else if (average < 80)
        light(3);
    else if (average < 90)
        light(2);
    else
        light(1);
}

//light the number of LEDs given by nbrOn
void light(int nbrOn)
{
    for (byte i=0; i<nbrOn; i++)
        digitalWrite(ledPins[i], HIGH);
        
    for (byte i=nbrOn; i<NBR_LEDS; i++)
        digitalWrite(ledPins[i], LOW);
}

…and the receiver code:

// Daniel Jay Bertner - Bike communication modules
// Modified by Jack Christensen 11Nov2012

#include <LiquidCrystal.h>

#define START_DELIM '<'
#define RECV_TIMEOUT 10                     //consider a node "not available" after this many seconds with no message
#define MAX_RSSI_LEN 6                      //maximum RSSI value length to be accepted from transmitter nodes
//#define LCD_BACKLIGHT 9                     //for Jack's LCD

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);      //Daniel's wiring
//LiquidCrystal lcd(2, 3, 4, 5, 6, 7);        //Jack's wiring
unsigned long ms;                           //current sketch time
unsigned long lastRecv1;                    //time of last message from node 1
unsigned long lastRecv2;                    //time of last message from node 2

void setup()
{
    pinMode(LED_BUILTIN, OUTPUT);           //pin 13 LED
//    pinMode(LCD_BACKLIGHT, OUTPUT);         //for Jack's LCD
//    digitalWrite(LCD_BACKLIGHT, HIGH);      //for Jack's LCD
    Serial.begin(38400);
    lcd.begin(16, 2);
    lcd.clear();
}

enum STATES { WAIT, NODE, SKIP, RSSI };
uint8_t STATE;

//incoming message format from the XBees is: <n>sss where n is the node number (1 or 2) and sss is signal strength
void loop()
{
    int c;                  //input character
    static byte rssiLen;    //length of the signal strength number (to guard against unreasonable input)
    static boolean ledState;

    ms = millis();
    checkNodes();
    if ( Serial.available() > 0 ) {    //process the next character when it arrives
        c = Serial.read();
        switch (STATE) {
            
            case WAIT:    //wait for start delimiter (first time)
                if (c == START_DELIM) ++STATE;
                break;
                
            case NODE:    //determine which node the message is from
                digitalWrite(LED_BUILTIN, ledState = !ledState);    //toggle the LED for every msg received
                if (c == '1') {
                    lastRecv1 = ms;
                    lcd.setCursor(0, 0);
                    lcd.print("Bike1=      ");    //blank out previous value
                    lcd.setCursor(6, 0);
                    ++STATE;
                }
                else if (c == '2') {
                    lastRecv2 = ms;
                    lcd.setCursor(0, 1);
                    lcd.print("Bike2=      ");    //blank out previous value
                    lcd.setCursor(6, 1);
                    ++STATE;
                }
                else
                    STATE = WAIT;                 //something we weren't expecting
                break;
                
            case SKIP:    //skip the '>'
                rssiLen = 0;
                ++STATE;
                break;
                
            case RSSI:    //copy the RSSI value to the LCD
                if (c == START_DELIM)                        //has a new message started?
                   STATE = NODE;
                else if (++rssiLen > MAX_RSSI_LEN)
                    STATE = WAIT;                    //something is wrong, abandon this message
                else
                    lcd.write(c);
                break;                
        }
    }
}

//check the time of the last message from each node, mark them "N/A" if RECV_TIMEOUT is exceeded
void checkNodes(void)
{
    static unsigned long lastCheck;
    
    if (ms - lastCheck >= 1000) {    //no point in over doing it
        lastCheck = ms;
        if (lastRecv1 == 0 || ms - lastRecv1 >= RECV_TIMEOUT * 1000) {
            lcd.setCursor(0, 0);
            lcd.print("Bike1=N/A    ");
       }
        
        if (lastRecv2 == 0 || ms - lastRecv2 >= RECV_TIMEOUT * 1000) {
            lcd.setCursor(0, 1);
            lcd.print("Bike2=N/A    ");
        }
    }
}