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

Committer:
sventura3
Date:
Thu Oct 22 18:52:54 2015 +0000
Revision:
0:7e6c07be1754
Child:
1:238f6a0108e7
LidarLitev2 Library for distance reading

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sventura3 0:7e6c07be1754 1 #ifndef LidarLitev2_H
sventura3 0:7e6c07be1754 2 #define LidarLitev2_H
sventura3 0:7e6c07be1754 3
sventura3 0:7e6c07be1754 4
sventura3 0:7e6c07be1754 5 #include "mbed.h"
sventura3 0:7e6c07be1754 6
sventura3 0:7e6c07be1754 7
sventura3 0:7e6c07be1754 8 class LidarLitev2
sventura3 0:7e6c07be1754 9 {
sventura3 0:7e6c07be1754 10 public:
sventura3 0:7e6c07be1754 11 LidarLitev2(PinName sda, PinName scl, bool = true); // Constructor iniates I2C setup
sventura3 0:7e6c07be1754 12 void configure(int = 0, int = 0xc4); // Configure the mode and slave address
sventura3 0:7e6c07be1754 13 void beginContinuous(bool = true, char = 0x04, char = 0xff, int = 0xc4); //Enable if using continous setup with mode from Lidar and pulldown
sventura3 0:7e6c07be1754 14 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.
sventura3 0:7e6c07be1754 15 // Returns distance as a integer in cm
sventura3 0:7e6c07be1754 16
sventura3 0:7e6c07be1754 17 int distanceContinuous(int = 0xc4); // 1.) Set Lidar circuit for continuous mode
sventura3 0:7e6c07be1754 18 // 2.) utilize the beginContinous function and configure as desired
sventura3 0:7e6c07be1754 19 // This function returns distance without any need to activate the lidar senore through a write command,
sventura3 0:7e6c07be1754 20 // instead the mode pin pulls down when the lidar is ready for a read
sventura3 0:7e6c07be1754 21 // Returns distance as a integer in cm
sventura3 0:7e6c07be1754 22
sventura3 0:7e6c07be1754 23 private:
sventura3 0:7e6c07be1754 24 // I2C Functions //
sventura3 0:7e6c07be1754 25 ///////////////////
sventura3 0:7e6c07be1754 26 I2C i2c; // Kept private as to prevent changing the I2C once set in the constructor of LidarLitev2
sventura3 0:7e6c07be1754 27 };
sventura3 0:7e6c07be1754 28
sventura3 0:7e6c07be1754 29 #endif /* LidarLitev2_H */