Xbee communication problem

Hi all,

I m using fio and 2 pcs xbeep24 s1. One xbee attached on my fio and the other xbee attached on my pc with xbee explorer.I just want read my sensor datas on my pc with ASCII table.I just reading strange characters on xctus serial.I tried other serials,didnt solve for me. Here is my code:

#include “DHT.h”

#define DHT1PIN 2

#define DHT2PIN 7

#define DHT3PIN 4

#define DHT1TYPE DHT22

#define DHT2TYPE DHT22

#define DHT3TYPE DHT22

DHT dht1(DHT1PIN, DHT1TYPE, 3);

DHT dht2(DHT2PIN, DHT2TYPE, 3);

DHT dht3(DHT3PIN, DHT3TYPE, 3);

void setup(){

Serial.begin(9600);

dht1.begin();

dht2.begin();

dht3.begin();

}

void loop(){

delay(2000);

float h1 = dht1.readHumidity();

float t1 = dht1.readTemperature();

float h2 = dht2.readHumidity();

float t2 = dht2.readTemperature();

float h3 = dht3.readHumidity();

float t3 = dht3.readTemperature();

if(isnan (h1) || isnan(t1)) {

Serial.println(“Sicaklik ve nem bilgisi bekleniyor…”);

}else{

Serial.print("Nem1: ");

Serial.print(h1);

Serial.print(" %/t");

Serial.print("Sicaklik1: ");

Serial.print(t1);

Serial.println(" *C ");

}

if(isnan(h2) || isnan(t2)){

Serial.println(“Sicaklik ve nem bilgisi bekleniyor…”);

}else{

Serial.print(“Nem2 :”);

Serial.print(h2);

Serial.print(" %/t");

Serial.print("Sicaklik2: ");

Serial.print(t2);

Serial.println(" *C ");

}

if(isnan(h3) || isnan(t3)){

Serial.println(“Sicaklik ve nem bilgisi bekleniyor…”);

}else{

Serial.print(“Nem3 :”);

Serial.print(h3);

Serial.print(" %/t");

Serial.print("Sicaklik3: ");

Serial.print(t3);

Serial.println(" *C ");

}

Serial.println();

}

and reading strange characters.Any helps will be wonderful.I m using Pın DIO 0 on xbee.

Kind regards,

Eren

The data is Binary not ASCII.

It helps better if you also show us the characters that do get printed into the serial monitor. Prefferable you should use a serial monitor application which can show the serial data as (hexa)decimal values also, instead of only as Ascii-symbols. (as the Arduino Serial monitor is limited to) Some bytes that are sent do not have a Ascii symbol associated to them and are therefore not printed/skipped. This gives you insufficient information as to what is going on on the serial link. Even if some bytes are shown as weird ASCII symbols then it is hard to translate them to a number.

Do the weird characters/symbols also come out if you only print the normal text ( “Nem1:”, “Sicaklik1:” etc.), and do not send the float variables in your program? To test, disable those serial.print statements. If so then the Xbee might be in API packet mode, and not in the default transparent mode. Make sure it is not in APImode.

If the weird characters only show up when the float variables for temperature and hummidity are expected then the Serial.print command does not print floats as you expect it. It likely sends the individual byte values from memory that make up the float variable. And not as ASCII format in decimal notation.

P.s. I presume this is the library that you are using?

https://github.com/adafruit/DHT-sensor-library

Ps 2

Sorry, I didn’t notice that you used xctu as serial monitor. Which version of it? Either way, the new and old versions can both show hex values.