Home/Support/Support Forum/Need help about Xbee Arduino Receiver source code
New and improved user forum site coming soon

Need help about Xbee Arduino Receiver source code

0 votes
Excuse me, i am newbie and i need some help about receiver code for my Xbee Coordinator API. i am using Xbee S2.

this is my source code from Xbee Router as Transmitter.

#include <Printers.h>
#include <XBee.h>
#include <SoftwareSerial.h>
int ledPin = 13;
int EP =9;
XBee xbee = XBee();
SoftwareSerial Xbee(0,1);
uint8_t payload[]={0,0,0,0,0,0,0,0,0,0};
XBeeAddress64 addr64 = XBeeAddress64(0x00000000,0x00000000);
//create packet
ZBTxRequest tx = ZBTxRequest(addr64, payload, sizeof(payload));
ZBTxStatusResponse txStatus = ZBTxStatusResponse();

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(EP, INPUT); //set EP input for measurment
Serial.begin(9600); //init serial 9600

void loop() {
// put your main code here, to run repeatedly:

long measurement =TP_init();
// Serial.print("measurment = ");
if (measurement > 1000){
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);

if (xbee.readPacket(500)) {
// got a response!

// should be a znet tx status
if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE) {
} else if (xbee.getResponse().isError()) {
//nss.print("Error reading packet. Error code: ");


long TP_init(){
long measurement=pulseIn (EP, HIGH); //wait for the pin to get HIGH and returns measurement
return measurement;

My Xbee Coordinator API always sending frames log 'IO Data Sample RX Indicator'.
can someone help me make the receiver code for my Xbee Coordinator API based on my Transmitter code? thanks
asked Jan 24, 2018 in IEEE 802.15.4 by Rio Kitsda New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
I am sorry but this is something you really need to get help with on an Arduino Coding site.
answered Jan 25, 2018 by mvut Veteran of the Digi Community (15,515 points)