pozyxLabs / Pozyx-Arduino-library

The Arduino library for use with the pozyx accurate indoor positioning system.
https://www.pozyx.io
MIT License
78 stars 53 forks source link

Do remote ranging not working #4

Closed dgoexail closed 8 years ago

dgoexail commented 8 years ago

Hi I am trying get the range between two anchors with the function doRemoteRanging but the function always return POZYX_FAIL.

The id's of the anchors provided to the function are corrects. The anchors both answer to the doRanging from the pozyx correctly.

Did i misunderstood the function goal ? or am i missing something ?

Thank you for your help.

samuelvdv commented 8 years ago

Hi, I have verified this and indeed something was wrong; A bad pointer was one of the issues :). It should be fixed now.

The following tested code performs ranging between two random remote pozyx devices in the vicinity of the tag:

 int status = Pozyx.doDiscovery();

  uint8_t list_size = 0;
  status = Pozyx.getDeviceListSize(&list_size);
  Serial.print("Number of pozyx devices discovered: ");
  Serial.println(list_size);

  if(list_size >= 2)
  {
    uint16_t devices[2] = {0, 0};
    status = Pozyx.getDeviceIds(devices, 2);
    Serial.println("Ranging between: ");
    Serial.println(devices[0], HEX);
    Serial.println(devices[1], HEX);

    device_range_t range;
    status = Pozyx.doRemoteRanging(devices[0], devices[1], &range);
    Serial.print("Remote ranging status: ");
    Serial.println(status);      
    Serial.print("Distance (mm): ");
    Serial.println(range.distance);
    Serial.print("Signal strength (dBm): ");
    Serial.println(range.RSS);
  }

Hope this helps, Samuel