XBee communication and serial monitor

I have some problems with the xbee communication.
I want to messure temperature, pressure and some other stuff with an Adafruit BME280 sensor, and then display it in the serial monitor. With USB connection everything works, now I tried to run it wireless with an XBee connectet to my Arduino Uno and another XBee connected via USB dongle to my computer.
But the serial monitor simply shows nothing.

I managed to turn on an LED via XBee, so connection and wiring should be ok.
I tried a lot with XBee.write and XBee.read functions, but I didn’t get it to work…

I hope someone can help me =)

This is my code: (sorry for the german comments)

/* Dieses Programm berechnet die Strömungsgeschwindigkeit mit Hilfe eines BME280 
*  "presure, Temperature and Humidity" Sensores, sowie eines Drucksensors angeschlossen
*  an ein Pitorohr (p_stau - p_unendlich).
*  Messwerte des Drucksensors an A0 anschließen.
*  BME280: 
*  VIN an 5V anschließen.
*  GND an GND anschließen.
*  SCK an A5 anschließen.
*  SDI an A4 anschließen.
*  Der Druck, bei dem der Drucksensor 5V ausgibt muss in der ersten Programmzeile 
*  als max_druck in mbar eingegeben werden.

double max_druck = 50; // maximaler Durck, bei dem Sonsorspannung 5V ausgegeben wird, in mbar

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <SoftwareSerial.h>
SoftwareSerial XBee(0, 1); // RX, TX

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

double t; // Temperatur in °C
double p; // Luftdruck in Pa
double phi; // relative Luftfeuchtigkeit
double R_f; // Gaskonstante der feuchten Luft
double R_l = 287.058; // J/(kg*K) // Gaskonstante der trockenen Luft
double R_d = 461.523; // J/(kg*K) // Gaskonstante von Wasserdampf
double p_d; // Sättigungsdampfdruck
double ro; // Luftdichte
double u; // Stroemungsgeschwindigkeit 
double druck_dif; // p_stau - p_unendlich

Adafruit_BME280 bme; // I2C

void setup() {
 Serial.println(F("BME280 test"));

 if (!bme.begin()) {
   Serial.println("Could not find a valid BME280 sensor, check wiring!");
   while (1);

void loop() {
   t = bme.readTemperature();
   p = bme.readPressure();
   phi = bme.readHumidity() / 100;

   p_d = 611.2*exp((17.62*t)/(243.12+t));

   R_f = R_l/(1-phi*(p_d/p)*(1-(R_l/R_d)));

   ro = p/(R_f*(t+273.15));

   druck_dif = max_druck*100/1024*analogRead(A0);   

   u = sqrt(2*druck_dif/ro);

   Serial.print("Temperatur = ");
   Serial.println(" *C");

   Serial.print("Luftdruck = ");
   Serial.print(p / 100.0F);
   Serial.println(" hPa");

   Serial.print("relative Luftfeuchtigkeit = ");
   Serial.println(" %");

   Serial.print("Stroemungsgeschwindigkeit = ");
   Serial.println(" m/s");

Check out this YoutTube series - it helped me out a lot. Covers AT mode, digital / analog inputs and outputs in API mode, as well as setup.

Also, put your code in </> tags

so the code looks like this

It makes it easier to view, and copy and paste.

Here's what is most likely the culprit:

SoftwareSerial XBee(0, 1); // RX, TX

This is because pins 0 and 1 are the HARDWARE serial pins (i.e. they are serial TX and RX by default).

If you really want to use 0 and 1 as your TX and RX, then you can't call the Serial commands like you do in your code.

ALSO, in your second sketch, you initialize your XBee class, but you don't call any of its methods. In other words, your second sketch is neither receiving or sending XBee packets.

thanks for the advices. I changed the RX and TX pins to pin 2 and 3, so I don’t have to disconnect the Xbee from Arduino when I want to upload a new sketch =)

But is it possible to run the thing in general with my set up (see attachment), or do I need a second arduino placed between Xbee II and my computer?

But is it possible to run the thing in general with my set up

Yes. But you've left out a lot of details, like how the XBee is connected to the Arduino, what kind of XBees you are using, how they are configured (Don't drink the digi koolaid; they DO need to be configured), etc.

Hey can you share your final code. I am also stuck at the same point