# API Mode XBee Series 1 Analog Sensor

**URL:** <https://forums.digi.com/t/api-mode-xbee-series-1-analog-sensor/20907>\
**Category:** XBee & XBee Gateway\
**Tags:** xbee-pro\
**Created:** [November 18, 2019, 11:29am UTC](https://forums.digi.com/t/api-mode-xbee-series-1-analog-sensor/20907 "2019-11-18T11:29:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nabatta](https://avatars.discourse-cdn.com/v4/letter/n/f05b48/32.png) [@nabatta](https://forums.digi.com/u/nabatta)\
**Post date:** [November 18, 2019, 11:29am UTC](https://forums.digi.com/t/api-mode-xbee-series-1-analog-sensor/20907/1 "2019-11-18T11:29:46Z")

</div>

Hello! I have 2 XBee S1’s with one as the coordinator hooked up to an Arduino Uno and one as the end device connected to a pressure sensitive resistor. I am trying to send the analog signal from the one XBee to the other using API mode. I am currently using the following code:

void setup() {  
Serial.begin(9600);  
}

void loop() {  
if (Serial.available()\>21){  
for (int i=0; i\<22; i++){  
Serial.print(Serial.read(),HEX);  
Serial.print(“,”);  
}  
Serial.println();  
}

The issue, however, is that the data that is printing is not consistent with what I would expect.

The first couple lines I receive are as predicted:  
7E , 0 , A , 83 , 0 , 0 , 27 , 0 , 1 , 2 , 0 , 0 , F , 43  
In this case from what I understand, F is my analog value from the sensor.

However, after a short period of time, the packets become much shorter:  
7E , 0 , A , 83 , 0 , 24 , 2 , 55

I am not sure what is causing this issue. Possibly something with my code? Thank you!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [November 19, 2019, 10:40am UTC](https://forums.digi.com/t/api-mode-xbee-series-1-analog-sensor/20907/2 "2019-11-19T10:40:53Z")

</div>

These are invalid API frames. You can verify that by using the XCTU’s API frame explorer.

---

<div class="post-metadata">

**Author:** ![nabatta](https://avatars.discourse-cdn.com/v4/letter/n/f05b48/32.png) [@nabatta](https://forums.digi.com/u/nabatta)\
**Post date:** [November 19, 2019, 2:34pm UTC](https://forums.digi.com/t/api-mode-xbee-series-1-analog-sensor/20907/3 "2019-11-19T14:34:34Z")

</div>

How can I fix this?

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [November 20, 2019, 4:06pm UTC](https://forums.digi.com/t/api-mode-xbee-series-1-analog-sensor/20907/4 "2019-11-20T16:06:48Z")

</div>

You are going to need to adjust your code that you are using to assemble the API frames till you get valid frames being sent to the radio.
