   Serial.print("list size: ");
   Serial.println(status*list_size);
   
+  if(list_size == 0){
+    Serial.println("Calibration failed.");
+    Serial.println(Pozyx.getSystemError());
+    return;
+  }
+  
   uint16_t device_ids[list_size];
   status &= Pozyx.getDeviceIds(device_ids,list_size);
   

////////////////////////////////////////////////

uint8_t num_anchors = 4;                                    // the number of anchors
uint16_t anchors[4] = {0x1156, 0x256B, 0x3325, 0x4244};     // the network id of the anchors
int32_t heights[4] = {2750, 2000, 1900, 2350};              // anchor z-coordinates in mm
boolean bProcessing = false;                                // set this to true to output data for the processing sketch         

// only required for manual anchor calibration
int32_t anchors_x[4] = {0, 10000, 1000, 9000};              // anchor x-coorindates in mm
int32_t anchors_y[4] = {0, 0, 7000, 8000};                  // anchor y-coordinates in mm


    delay(100);
    abort();
  }
  
  // if the automatic anchor calibration is unsuccessful, try manually setting the anchor coordinates.
  // fot this, you must update the arrays anchors_x, anchors_y and heights above
  // comment out the doAnchorCalibration block and the if-statement above if you are using manual mode
  //SetAnchorsManual();

  printCalibrationResult();
  delay(3000);
