While compiling i have some errors here is the error message
sketch_sep13b:40:25: error: incompatible types in assignment of 'uint8_t {aka unsigned char}' to 'uint8_t [8] {aka unsigned char [8]}'
payload = zbRx.getData(i);
here is my code
#include <XBee.h>
#include <string.h>
uint8_t payload[8] = {0,0,0,0,0,0,0,0};//initialises the data array with 0
char temp;
char hum;
XBee xbee = XBee();
ZBRxResponse zbRx = ZBRxResponse();
char Tb[4];
char Hb[4];
typedef struct {
float temp = 0.0f;//temperature
float hum = 0.0f; //RHumidity
// float measuredvbat = 0.0f;// battery
} load;
load theData;
void setup()
{
// delay(1000);
Serial.begin(9600);
xbee.begin(Serial);
Serial.println("Ready");
}
// continuously reads packets, looking for ZB Receive or Modem Status
void loop()
{
xbee.readPacket();
if (xbee.getResponse().isAvailable()){
if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE){
xbee.getResponse().getZBRxResponse(zbRx);
for(int i = 0; i < zbRx.getDataLength(); i++){
payload = zbRx.getData(i);
}
temp = zbRx.getData(0);// get the T for temperature to ID the value*
Tb[0]= zbRx.getData(0);
Tb[1]= zbRx.getData(1);
Tb[2]= zbRx.getData(2);
Tb[3]= zbRx.getData(3);
memcpy(&theData.temp, &Tb, 4);
Hb[0]= zbRx.getData(4);
Hb[1]= zbRx.getData(5);
Hb[2]= zbRx.getData(6);
Hb[3]= zbRx.getData(7);
memcpy(&theData.hum, &Hb, 4);
}
}
Serial.print(" Humidity: ");
Serial.print(theData.hum);
Serial.print(" ");
Serial.print("Temperature: ");
Serial.print(theData.temp);
Serial.println("\n" );
delay(500);
}