TroubleshootingArduino

Need help combining Arduino + IO expansion shield v7 + Digi XBee 3

userHead Luke00 2025-04-25 22:26:37 879 Views0 Replies

Hello,

I am trying to transmit some messages between two Arduinos using the Digi XBee 3 module and IO expansion shields. I am having some issues as there is no print out in the serial monitor on the receiving side. I suspect I have misinterpreted the pinout of the expansion shield and as such the pins in the Arduino code is wrong. The modules themselves have been confirmed to be in a network together using XCTE. 

 

This is the code of the transmitter:
#include <SoftwareSerial.h>


 

// XBee connected to pins 0 (RX) and 1 (TX)

SoftwareSerial xbee(0, 1);


 

void setup() {

  xbee.begin(9600);

  Serial.begin(9600);  // For debugging

  randomSeed(analogRead(0));

}


 

void loop() {

  String message = "Msg-" + String(random(1000, 9999));

 

  xbee.println(message); // Send to XBee

  Serial.println("Sent: " + message); // Debug


 

  delay(3000); // Wait 3 seconds before sending next message

}


This is the code of the receiver:
#include <SoftwareSerial.h>


 

// XBee connected to pins 0 (RX) and 1 (TX)

SoftwareSerial xbee(0, 1);


 

void setup() {

  Serial.begin(9600);    // For monitoring on the laptop

  xbee.begin(9600);      // Communication with the XBee

  Serial.println("Receiver ready...");

}


 

void loop() {a

  if (xbee.available()) {

    String received = "";

    while (xbee.available()) {

      char c = xbee.read();

      received += c;

    }

    Serial.print("Received: ");

    Serial.println(received);

  }

}


Any help would be appreciated. As mentioned, I suspect the issue lies with the expansion shield and the pins.