I m trying to receive data from xbee console XCTU to serial monitor , i have connected xbee 1 to arduino uno and arduino uno to laptop and xbee 2 to different laptop
receive code :-
kinda working code
#include <SoftwareSerial.h>
// Define the XBee communication pins
const int xbeeRxPin = 6; // XBee Rx pin (Connect to Arduino Tx pin)
const int xbeeTxPin = 7; // XBee Tx pin (Connect to Arduino Rx pin)
SoftwareSerial xbeeSerial(xbeeRxPin, xbeeTxPin); // Create a SoftwareSerial object for XBee communication
void setup() {
Serial.begin(9600); // Start the serial communication for debugging
xbeeSerial.begin(9600); // Start the XBee serial communication
Serial.println("XBee Receiver is ready to receive data!");
}
void loop() {
// Check if data is available from XBee
if (xbeeSerial.available()) {
Serial.println("Data available from XBee...");
char val = "";
char receivedChar = char(xbeeSerial.read());
// Print the received data from XBee 1's console (as ASCII value)
Serial.print("receivedChar -->");
Serial.println(receivedChar);
val=val+receivedChar;
Serial.print("val -->");
Serial.println(val);
} else {
// Serial.println("No data available from XBee...");
}
// Add any other code you want to run continuously here
// delay(1000); // Add a short delay to prevent rapid looping
}
first i was getting the output but now it is showing no output
please help