Apps and platforms
Arduino IDE
Project description
Code
LiDAR-Lite Bias
arduino
1//Interface LiDAR-Lite module and display distance on LCD 2//With receiver bias corrections 3 4#include <LiquidCrystal.h> 5#include <Wire.h> 6#include <LIDARLite.h> 7 8//variable declarations 9int distancecm; 10int distancein; 11uint8_t i = 0; 12const int RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7; 13 14LiquidCrystal lcd(RS,EN,D4,D5,D6,D7); //set Uno pins that are connected to LCD, 4-bit mode 15LIDARLite lidarLite; 16 17void setup() { 18 lcd.begin(16,2); //set 16 columns and 2 rows of 16x2 LCD 19 lidarLite.begin(0, true); //set config to default and I2C to 400kHz, starts I2C 20 lidarLite.configure(0); //there are 6 different configs available 21} 22 23void loop() { 24 distancecm = lidarLite.distance(); //with bias correction 25 distancein = distancecm*0.3937; //1cm = 0.3937in 26 27 //display distance to LCD 28 lcd.clear(); 29 lcd.print("Distance: "); 30 lcd.print(distancecm); 31 lcd.print("cm"); 32 lcd.setCursor(10,1); 33 lcd.print(distancein); 34 lcd.print("in"); 35 delay(1000); 36 37 for(i = 0; i < 100; i++){ 38 distancecm = lidarLite.distance(false); //with bias correction 39 distancein = distancecm*0.3937; //1cm = 0.3937in 40 41 //display distance to LCD 42 lcd.clear(); 43 lcd.print("Distance: "); 44 lcd.print(distancecm); 45 lcd.print("cm"); 46 lcd.setCursor(10,1); 47 lcd.print(distancein); 48 lcd.print("in"); 49 delay(750); 50 } 51}
LiDAR-Lite Bias
arduino
1//Interface LiDAR-Lite module and display distance on LCD 2//With receiver bias corrections 3 4#include <LiquidCrystal.h> 5#include <Wire.h> 6#include <LIDARLite.h> 7 8//variable declarations 9int distancecm; 10int distancein; 11uint8_t i = 0; 12const int RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7; 13 14LiquidCrystal lcd(RS,EN,D4,D5,D6,D7); //set Uno pins that are connected to LCD, 4-bit mode 15LIDARLite lidarLite; 16 17void setup() { 18 lcd.begin(16,2); //set 16 columns and 2 rows of 16x2 LCD 19 lidarLite.begin(0, true); //set config to default and I2C to 400kHz, starts I2C 20 lidarLite.configure(0); //there are 6 different configs available 21} 22 23void loop() { 24 distancecm = lidarLite.distance(); //with bias correction 25 distancein = distancecm*0.3937; //1cm = 0.3937in 26 27 //display distance to LCD 28 lcd.clear(); 29 lcd.print("Distance: "); 30 lcd.print(distancecm); 31 lcd.print("cm"); 32 lcd.setCursor(10,1); 33 lcd.print(distancein); 34 lcd.print("in"); 35 delay(1000); 36 37 for(i = 0; i < 100; i++){ 38 distancecm = lidarLite.distance(false); //with bias correction 39 distancein = distancecm*0.3937; //1cm = 0.3937in 40 41 //display distance to LCD 42 lcd.clear(); 43 lcd.print("Distance: "); 44 lcd.print(distancecm); 45 lcd.print("cm"); 46 lcd.setCursor(10,1); 47 lcd.print(distancein); 48 lcd.print("in"); 49 delay(750); 50 } 51}
LiDAR-Lite No Bias
arduino
1//Interface LiDAR-Lite module and display distance on LCD 2//Without receiver bias corrections 3 4#include <LiquidCrystal.h> 5#include <Wire.h> 6#include <LIDARLite.h> 7 8//variable declarations 9int distancecm; 10int distancein; 11const int RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7; 12 13LiquidCrystal lcd(RS,EN,D4,D5,D6,D7); //set Uno pins that are connected to LCD, 4-bit mode 14LIDARLite lidarLite; 15 16void setup() { 17 lcd.begin(16,2); //set 16 columns and 2 rows of 16x2 LCD 18 lidarLite.begin(0, true); //set config to default and I2C to 400kHz, starts I2C 19 lidarLite.configure(0); //there are 6 different configs available, 0 is default 20} 21 22void loop() { 23 distancecm = lidarLite.distance(false); //without bias correction, faster distance measurements performed 24 distancein = distancecm*0.3937; //1cm = 0.3937in 25 26 //display distance to LCD 27 lcd.clear(); 28 lcd.print("Distance: "); 29 lcd.print(distancecm); 30 lcd.print("cm"); 31 lcd.setCursor(10,1); 32 lcd.print(distancein); 33 lcd.print("in"); 34 delay(1000); 35}
Downloadable files
Circuit Schematic
Circuit Schematic
Circuit Schematic
Circuit Schematic
Documentation
Adapter Plate
Adapter Plate
Adapter Plate
Adapter Plate
Comments
Only logged in users can leave comments
ejshea
0 Followers
•0 Projects
6
0