Hello,
My question actually is simple but I am doing something wrong. So I have arduino fio 2 xbee pro s3b and dht 22 sensor, so the arduino read temp data throught dht 22 and it sends this data another xbee,
So my xbee configuration like that.
http://s22.postimg.org/4bip6i12p/fio1.png
http://s11.postimg.org/6nbcr31cz/fio2.png
#include
SoftwareSerial xBee = SoftwareSerial(2,3);
#include
dht DHT;
#define DHT22_PIN 2
struct
{
uint32_t total;
uint32_t ok;
uint32_t crc_error;
uint32_t time_out;
uint32_t connect;
uint32_t ack_l;
uint32_t ack_h;
uint32_t unknown;
} stat = { 0,0,0,0,0,0,0,0};
void setup()
{
Serial.begin(9600);
Serial.println("dht22_test.ino");
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT_LIB_VERSION);
xBee.begin(9600);
Serial.println();
Serial.println("Type, status, Humidity (%), Temperature (C) Time (us)");
}
void loop()
{
// READ DATA
Serial.print("DHT22, ");
uint32_t start = micros();
int chk = DHT.read22(DHT22_PIN);
uint32_t stop = micros();
stat.total++;
switch (chk)
{
case DHTLIB_OK:
stat.ok++;
Serial.print("OK, ");
break;
case DHTLIB_ERROR_CHECKSUM:
stat.crc_error++;
Serial.print("Checksum error, ");
break;
case DHTLIB_ERROR_TIMEOUT:
stat.time_out++;
Serial.print("Time out error, ");
break;
case DHTLIB_ERROR_CONNECT:
stat.connect++;
Serial.print("Connect error, ");
break;
case DHTLIB_ERROR_ACK_L:
stat.ack_l++;
Serial.print("Ack Low error, ");
break;
case DHTLIB_ERROR_ACK_H:
stat.ack_h++;
Serial.print("Ack High error, ");
break;
default:
stat.unknown++;
Serial.print("Unknown error, ");
break;
}
// DISPLAY DATA
Serial.print(DHT.humidity, 1);
Serial.print(", ");
Serial.print(DHT.temperature, 1);
Serial.print(", ");
Serial.print(stop - start);
Serial.println();
if (stat.total % 20 == 0)
{
Serial.println("
TOT OK CRC TO UNK");
Serial.print(stat.total);
Serial.print(" ");
Serial.print(stat.ok);
Serial.print(" ");
Serial.print(stat.crc_error);
Serial.print(" ");
Serial.print(stat.time_out);
Serial.print(" ");
Serial.print(stat.connect);
Serial.print(" ");
Serial.print(stat.ack_l);
Serial.print(" ");
Serial.print(stat.ack_h);
Serial.print(" ");
Serial.print(stat.unknown);
Serial.println("
");
}
xBee.print(DHT.temperature);
delay(2000);
}
//
// END OF FILE
//
So I upload code fio and plug to battery but when I observing there is no any data is coming (via xct-u) anyway, if you want I can share more information. I really need your help