Hi everyone,
I got problems when I tried to send temp and humid from dht11 to xbee coordinator via arduino ide. I am not receiving the data packet containing the temperature data from xbee end device sending data to coordinator. When Arduino is uploaded code, serial monitor displays some weird characters. I guess that the result was in incorrect format or sth … Pls help me.
This is electronic components I use:
- Xbee S2C
- Arduino UNO
- Xbee Shield Arduino
- DHT11 sensor
- Xbee USB Adapter Ft232rl
Configure Xbee in XCTU:
Coordinator:
Function: ZIGBEE TH Reg
ID PAN ID: 1234
SC Scan Channels: 7FFF
JV Channel Verification: Disabled
CE Coordinator Enable: Enabled
AP API Enable: API enabled [1]
Router:
Function: ZIGBEE TH Reg
ID PAN ID: 1234
SC Scan Channels: 7FFF
JV Channel Verification: Enabled
CE Coordinator Enable: Disabled
AP API Enable: API enabled with Escaping [2]
Code Arduino:
#include
#include
#include
#include “DHT.h”
#define DHTPIN 2
#define DHTTYPE DHT11
//Initialize XBee ZB client
XBee xbee = XBee();
//Payload byte array
uint8_t payload[8];
//Send to coordinator
XBeeAddress64 addr64 = XBeeAddress64(0, 0);
//Create request for XBee ZB
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
//Initialize DHT sensor module
DHT dht(DHTPIN, DHTTYPE);
void set_float_to_payload(float value, int index) {
uint8_t *value_array;
value_array = reinterpret_cast(&value);
for(int i=0; i