Receiving sensor data through Xbee

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);

// continuously reads packets, looking for ZB Receive or Modem Status
void loop()
if (xbee.getResponse().isAvailable()){
if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE){

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(" ");

Serial.print("Temperature: ");

Serial.println("\n" );


1 Like

Please help i am new to arduino and xbee

On your IDE screen, which line is line number 40? Your error begins at position 25 on that line of code?


I tried to change this line as follows. But I get 0.00 readings for temp and humidity.

payload[i] = zbRx.getData(i);

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.