LidarLitev2 Library for distance reading. Capable of both single distance reads and continuous distance read setup.
Dependents: Lidar_Distance Lidar_DistanceContinuous Lidar_2D_Mapping Motions_Secure_Server_IUPUI ... more
LidarLitev2 Class Reference
My LidarLite class Used for controlling and interacting with the LidarLitev2 Example: More...
#include <LidarLitev2.h>
Public Member Functions | |
void | configure (int=0, int=0xc4) |
Configure the different modes of the Lidar. | |
void | beginContinuous (bool=true, char=0x04, char=0xff, int=0xc4) |
Sets the Lidar to read continuously, indicating its ready to be read from by the modepin pulling down, a cerntain amount of times. | |
int | distance (bool=true, bool=true, int=0xc4) |
Calclulates distance through I2C protocol of activating sensor with a write, then a write for the register, and a read. | |
int | distanceContinuous (int=0xc4) |
1.) Set Lidar circuit for continuous mode 2.) utilize the beginContinous function and configure as desired This function returns distance without any need to activate the lidar senore through a write command, instead the mode pin pulls down when the lidar is ready for a read Returns distance as a integer in cm |
Detailed Description
My LidarLite class Used for controlling and interacting with the LidarLitev2 Example:
//Measures distance from the lidarlite and prints it through serial #include "LidarLitev2.h" LidarLitev2 Lidar(p28, p27); Serial pc(USBTX,USBRX); Timer dt; int main() { pc.baud(115200); Lidar.configure(); dt.start(); while(1){ pc.printf("distance = %d cm frequency = %.2f Hz\n", Lidar.distance(), 1/dt.read()); dt.reset(); } }
Definition at line 34 of file LidarLitev2.h.
Member Function Documentation
void beginContinuous | ( | bool | modePinLow = true , |
char | interval = 0x04 , |
||
char | numberOfReadings = 0xff , |
||
int | LidarLitev2_addr = 0xc4 |
||
) |
Sets the Lidar to read continuously, indicating its ready to be read from by the modepin pulling down, a cerntain amount of times.
Definition at line 36 of file LidarLitev2.cpp.
void configure | ( | int | config = 0 , |
int | LidarLitev2_addr = 0xc4 |
||
) |
Configure the different modes of the Lidar.
Definition at line 13 of file LidarLitev2.cpp.
int distance | ( | bool | stablizePreampFlag = true , |
bool | takeReference = true , |
||
int | LidarLitev2_addr = 0xc4 |
||
) |
Calclulates distance through I2C protocol of activating sensor with a write, then a write for the register, and a read.
Definition at line 66 of file LidarLitev2.cpp.
int distanceContinuous | ( | int | LidarLitev2_addr = 0xc4 ) |
1.) Set Lidar circuit for continuous mode 2.) utilize the beginContinous function and configure as desired This function returns distance without any need to activate the lidar senore through a write command, instead the mode pin pulls down when the lidar is ready for a read Returns distance as a integer in cm
Definition at line 94 of file LidarLitev2.cpp.
Generated on Tue Jul 12 2022 19:59:00 by 1.7.2