Ok.. before the obvious question of "there has been many topics on that, just do a search"... I have to say I did, and my whole day was spent debugging why it is not working, but the other people using the same method is working....

So basically.... I'm now calling for help.. desperate.

1.What I want to do. -Get RSSI values from XBee for Localization.2. Why use PWM, rather than the ATDB method? - I want more resolution... ATDB command returns range of 256 values only.3. What have I tried - pulseIn fucntion... and it is causing me much headache as to WHY hasn't it work.

The pulsein function gets the duration.. it is NOT working.... returns 0 values... when I get like a room far.. only it returned 100+- value... when I close in, it suddenly jumps to 0 again.

I thought it's because of pulseIn can't detect the pulses?

From Xbee datasheet,

PWM operates at 12MHz, period is 200us...

This is another baffling stuff to me.. Period according to frequency... 1/12M=0.08333us, Period according to statemet is 200us.. @@

if (rx.getOption() == ZB_PACKET_ACKNOWLEDGED) { // the sender got an ACK Serial.println("Sender get ACK."); } else { // we got it (obviously) but sender didn't get an ACK Serial.println("Sender did not get ACK."); } // set dataLed PWM to value of the first byte in the data

} else if (xbee.getResponse().getApiId() == MODEM_STATUS_RESPONSE) { xbee.getResponse().getModemStatusResponse(msr); // the local XBee sends this response on certain events, like association/dissociation

while(digitalRead(12)==HIGH); duration[0]=pulseIn(12,HIGH,1000); //get the duration.. it is NOT working.... returns 0 values... when I get like a room far.. only it //returned 100+- value... when I close in, it suddenly jumps to 0 again.

2. Why use PWM, rather than the ATDB method? - I want more resolution... ATDB command returns range of 256 values only.

Breaking a half-assed guess as to RSSI into 256 values is still going to have huge amounts of discrepancy in the distances you try to discern from those values.

Like printing a float to 12 decimal places, you can not make an inaccurate value more accurate by reading it a different way.

So... what you mean is... even if PWM values may have a higher resolution.. it still won't give a higher accuracy?

I need the resolution so that I can discern smaller changes in distances. Right now, if I'm using the DB command, it's sensitivity is 10CM per dB unit. When it's close. When it's further away, it' resolution increases...

I have to have a higher sensitivity/resolution distance per unit change.... so that is why I am making the PWM RSSI work, since it says in the datasheet, it is able to give a resolution of 2400 counts...