Skip to content

Commit

Permalink
A 15 second interval avoids XBee timeouts
Browse files Browse the repository at this point in the history
This is a guess, the timeout may be elsewhere.  With 15 seconds the remote
XBee can read and process the message.
  • Loading branch information
drbrain committed Jan 13, 2015
1 parent a5d9fe7 commit e656bbb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions temperature_monitor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define XBee_rx_PIN 2
#define XBee_tx_PIN 3
#define DHT22_PIN 4
#define interval 60
#define interval 15

DHT22 temp_sensor(DHT22_PIN);
SoftwareSerial XBee(XBee_rx_PIN, XBee_tx_PIN);
Expand All @@ -17,13 +17,14 @@ void setup(void)
XBee.begin(9600);

Serial.begin(9600);

delay(2000);
}

void loop(void)
{
DHT22_ERROR_t error_code;

delay(interval * 1000);
error_code = temp_sensor.readData();

write_int(0xFF00); // sync
Expand All @@ -37,6 +38,8 @@ void loop(void)
write_int(temp_sensor.getHumidity());
break;
}

delay(interval * 1000);
}

void write_int(int value) {
Expand Down

0 comments on commit e656bbb

Please sign in to comment.