Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of LidarLite by
LidarLite.h
- Committer:
- jakelarsen17
- Date:
- 2016-01-26
- Revision:
- 1:a01dc8b52be4
- Parent:
- 0:8e6304ab38d2
- Child:
- 2:917b2a1835b0
File content as of revision 1:a01dc8b52be4:
#ifndef LidarLite_H
#define LidarLite_H
#include "mbed.h"
// Default I2C Address of LIDAR-Lite.
//#define LIDARLite_Adr 0x62
// Commands
#define SET_CommandReg 0x00 // Register to write to initiate ranging
#define AcqMode 0x04 // Value to set in control register to initiate ranging
// Read Registers
#define GET_DistanceHBReg 0x0f // High byte of distance reading data
#define GET_DistanceLBReg 0x10 // Low byte of distance reading data
#define GET_Distance2BReg 0x8f // Register to get both High and Low bytes of distance reading data in 1 call
#define GET_VelocityReg 0x09 // Velocity measurement data
class LidarLite
{
public:
LidarLite(PinName sda, PinName scl); //Constructor
int16_t refreshVelocity(char, char); //refreshes velocity data from registers of sensor
int16_t refreshRange(char, char); //refreshes range data from registers of sensor
void configure(int, char);
int16_t getRange_cm(); //Read distance in cm from sensor
int16_t getVelocity_cms(); //Read velocity in cm/s from sensor
void changeAddress(char, bool, char);
void changeAddressMultiPwrEn(int, DigitalOut*, char*, char);
private:
Serial debug;
I2C i2c_;
int16_t distance_LL;
int16_t velocity_LL;
};
#endif /* LidarLite_H */
