I need to print data on the Arduino serial monitor received from the Xbee in AT mode. I have searched on most forums and have not found anything on how to do this.
I have my Xbee tx connected to Arduino nano Rx and rx connected to tx.
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.Sign up to join this community
You connected the Xbee to the single hardware Serial interface that the Nano has. Is is also used by the USB to Serial chip, which connects to the Serial Monitor. So what you are sending to the Xbee is also send to the Serial Monitor. What the Xbee sends is only send to the Arduino (since the Xbee TX pin is connected to RX of Arduino and also TX of the Arduinos USB to Serial chip).
But you can seperate then by using a
SoftwareSerial interface on any other pins of your liking. Then you can connect the Xbee to it. Then forward the output of the
SoftwareSerial interface to the
Serial interface. To see how this works have a look the first example of the
SoftwareSerial library. Its basically checking both interfaces, reads available data from one interface and writes it to the other (note the
write() in contrast to
print() since when forwarding you don't want to interpret the data again to another format like
Also there are plenty examples and tutorials about
SoftwareSerial on the web. An important restriction is, that only one
SoftwareSerial interface can listen to data at any time. The Hardware
Serial interface doesn't have such a problem.