Hey. I am trying to make my Xbee router send temperature readings to coordinator. I have set up my Xbees as AT Router and API Coordinator and managed to get them talking to each other, I can write digital HIGH or LOW to a remote Xbee. However, I am having troubles sending my DHT22 temperature sensor reading my coordinator. I have tried following this guide:
I have tried setting my D3 pin of remote router both ADC and digital input - I am not getting anything printed on the serial monitor.
I believe I cannot use his approach when using my sensor, because based on his code, he is using MSB and LSB whereas in my case, I do not need to set these two bits.
Any ideas how to send temperature form remote Xbee to coordinator?
Code:
#define DHTPIN 3 // what digital pin we're connected to
#include "DHT.h"
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin(9600);
dht.begin();
}
void loop()
{
if (Serial.available() >=21) {
if (Serial.read() == 0x7E){
//skip over the API frame bytes we don’t want
for (int i =0; i<19; i++) {
byte skip = Serial.read();
}
float t = dht.readTemperature();
Serial.print(t);
delay(100);
I believe I cannot use his approach when using my sensor, because based on his code, he is using MSB and LSB whereas in my case, I do not need to set these two bits.
Any ideas how to send temperature form remote Xbee to coordinator?