ibrahimuslu / xbee-arduino

Automatically exported from code.google.com/p/xbee-arduino
GNU General Public License v2.0
0 stars 0 forks source link

Xbee analog inputs #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Trying to read some analog valeu with the getAnalog() function

What is the expected output? What do you see instead?
The output that appears is like this example.

Analog (AI0) is 419
Analog (AI1) is 419
Analog (AI2) is 419
Analog (AI3) is 419
Analog (AI4) is 993
Analog (AI5) is 419

Notice that AI0 and AI4 are the pins that i need to read, but the value of pin 
0 is replicated to the other pins. Also, all values on pin 4 start to appear on 
pin 0 readings. I'm getting 19 samples per packet, and on the third sample, the 
value of pin 0 is equal to the value of pin 4 on the first sample, like this:

Sample 1:
Analog (AI0) is 419
Analog (AI1) is 419
Analog (AI2) is 419
Analog (AI3) is 419
Analog (AI4) is 993
Analog (AI5) is 419
Sample 2:
Analog (AI0) is 10
Analog (AI1) is 10
Analog (AI2) is 10
Analog (AI3) is 10
Analog (AI4) is 993
Analog (AI5) is 10
Sample 3:
Analog (AI0) is 993
Analog (AI1) is 993
Analog (AI2) is 993
Analog (AI3) is 993
Analog (AI4) is 32
Analog (AI5) is 993

What version of the product are you using? On what operating system?
Arduino 1.0 on windows 7

Please provide any additional information below.
I'm using the libelium Xbee shield, i think it is or was the official xbee 
shield. Is there any issue about this shield and the Xbee library?

Thanks in advance

Original issue reported on code.google.com by gzio...@gmail.com on 10 Jan 2012 at 1:09

GoogleCodeExporter commented 9 years ago

Original comment by andrew.rapp@gmail.com on 2 Feb 2014 at 6:44

GoogleCodeExporter commented 9 years ago
I've recently been using this library and had very similar issues with this 
part of the code. I believe I've pinpointed the cause of this, which is not 
very well documented in the manual.

If you check page 50: MM (MAC Mode) Command

"By default (MM = 0), Digi Mode is enabled and the module adds an extra header 
to the data portion of the 802.15.4 packet."

During testing I noticed that when disabling AES encryption this header would 
no longer appear within the packet and the method 
"RxIOSampleBaseResponse::getAnalog" functions as intended. Obviously the 
inclusion of this header will throw off any access to the data portion of the 
frame.

I was unable to find any further information about this header, as to whether 
it's size can vary based on configuration I'm unsure, but for my purposes it 
seemed to consist of four bytes in the position stated. I no longer have access 
to an xBee radio to test so it's unlikely I'll be able to contribute further 
than this.

Original comment by jmounte...@gmail.com on 22 Sep 2014 at 12:42