Home/Support/Support Forum/Unable to Serial.read() using Arduino and XBee

Unable to Serial.read() using Arduino and XBee

0 votes
Hi everyone.

I am developing a program in which I use an Arduino MEGA and a Wireless Proto Shield with an XBee mounted (API2).In the program I am working on I create a kind of 'menu' with different options, which is shown by the Serial. Once displayed, I choose one of those options and with a switch the program would be developed:

#include <XBee.h>

int option;

void setup() {

Serial.print("- MENU -\n");
Serial.print("1: Encontrar/Actualizar dispositivos\n");
Serial.print("2: Encender dispositivo\n");
Serial.print("3: Apagar dispositivo\n");
Serial.print("Introduzca opcion: ");

void loop() {


case 1:
Serial.print("\n\n-NODE DISCOVERY-\n\n");

case 2:




The problem is when using an XBee. When mounted, the Serial.read () doesn't work for me. That is, it does not display Serial.print (option) or enter the switch. It does not work.
However, when removing the XBee, I can already type an option through the Serial, it recognizes it and shows me what is inside the switch.

I do not know why, if the XBee interferes in any way or if I would have to proceed in another way to use the serial.
I would appreciate any advice. Thank you.
asked Jun 25, 2020 in XBee Programmable Development by AntonioGR96 New to the Community (1 point)
edited Jun 25, 2020 by mvut

Please log in or register to answer this question.

1 Answer

0 votes

This is something you really need to address on a Arduino forum.
answered Jun 29, 2020 by mvut Veteran of the Digi Community (14,676 points)