examples/GetDistanceI2cRio/src/LIDARLiteRio.cpp
/*------------------------------------------------------------------------------
  Distance

  Take a distance measurement and read the result.

  Process
  ------------------------------------------------------------------------------
  1.  Write 0x04 or 0x03 to register 0x00 to initiate an aquisition.
  2.  Read register 0x01 (this is handled in the read() command)
      - if the first bit is "1" then the sensor is busy, loop until the first
        bit is "0"
      - if the first bit is "0" then the sensor is ready
  3.  Read two bytes from register 0x8f and save
  4.  Shift the first value from 0x8f << 8 and add to second value from 0x8f.
      The result is the measured distance in centimeters.

  Parameters
  ------------------------------------------------------------------------------
  biasCorrection: Default true. Take aquisition with receiver bias
    correction. If set to false measurements will be faster. Receiver bias
    correction must be performed periodically. (e.g. 1 out of every 100
    readings).
------------------------------------------------------------------------------*/
Distance
Take a distance measurement and read the result.

Process

1.  Write 0x04 or 0x03 to register 0x00 to initiate an aquisition.
2.

Parameters

Default true. Take aquisition with receiver bias
correction. If set to false measurements will be faster. Receiver bias
correction must be performed periodically.
Distance Take a distance measurement and read the result . Process 1 . Write 0x04 or 0x03 to register 0x00 to initiate an aquisition . 2 . Parameters Default true . Take aquisition with receiver bias correction . If set to false measurements will be faster . Receiver bias correction must be performed periodically .
int LIDARLite_I2C::distance(bool biasCorrection){
  if(biasCorrection)
  {
    m_i2c.Write(0x00,0x04);
  }
  else
  {
    m_i2c.Write(0x00,0x03);
  }
  uint8_t distanceArray[2];
  read(kDistanceRegister, 2, distanceArray, true);
  int distance = (distanceArray[0] << 8) + distanceArray[1];
  return(distance);
}
int LIDARLite_I2C :: distance ( bool biasCorrection ) { if ( biasCorrection ) { m_i2c . Write ( 0x00 , 0x04 ) ; } else { m_i2c . Write ( 0x00 , 0x03 ) ; } uint8_t distanceArray [ 2 ] ; read ( kDistanceRegister , 2 , distanceArray , true ) ; int distance = ( distanceArray [ 0 ] << 8 ) + distanceArray [ 1 ] ; return ( distance ) ; }
Distance
Take a distance measurement and read the result.
Distance Take a distance measurement and read the result .
// Take acquisition & correlation processing with receiver bias correction
 // Take acquisition & correlation processing without receiver bias correction
 // Array to store high and low bytes of distance
 // Read two bytes from register 0x8f (autoincrement for reading 0x0f and 0x10)
 // Shift high byte and add to low byte
