jetsonhacks / jhlidarlite_v2 Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi @jetsonhacks,
Thank you for the project. I confirm that your code is working with LidarLite V3 & Jetson Nano, with the following wiring map:
VCC J41-4 -> Lidar-Lite (+) 5V (red wire)
GND J41-6 -> Lidar-Lite (-)
SCL J41-5 -> Lidar-Lite (SCL)
SDA J41-3 -> Lidar-Lite (SDA)
Plus, to get code working with L4T 32.2 i have to do the following small changes, due to modifications in libi2c & libi2c-dev (4.0-2)
diff --git a/example/LidarPlotSketch/PlotPractice.pro b/example/LidarPlotSketch/PlotPractice.pro
index 8f14a6e..a7efeda 100644
--- a/example/LidarPlotSketch/PlotPractice.pro
+++ b/example/LidarPlotSketch/PlotPractice.pro
@@ -30,3 +30,5 @@ OTHER_FILES += \
RESOURCES += \
PlotPractice.qrc
+
+unix|win32: LIBS += -li2c
diff --git a/example/LidarPlotSketch/lidarlite.h b/example/LidarPlotSketch/lidarlite.h
index 79f6b79..4c359f9 100644
--- a/example/LidarPlotSketch/lidarlite.h
+++ b/example/LidarPlotSketch/lidarlite.h
@@ -25,7 +25,6 @@
#define LIDARLITE_H
#include <cstddef>
-#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <cstdlib>
#include <cstdio>
@@ -33,6 +32,10 @@
#include <unistd.h>
#include <errno.h>
+extern "C" {
+ #include <i2c/smbus.h>
+ #include <linux/i2c-dev.h>
+}
// Information taken from PulsedLight knowledge base 5-4-15
// Internal Control Registers
diff --git a/example/Makefile b/example/Makefile
index d7d3f15..9cc68dd 100755
--- a/example/Makefile
+++ b/example/Makefile
@@ -1,2 +1,2 @@
all:
- g++ example.cpp ../src/lidarlite.cpp -I../src -o example
+ g++ example.cpp ../src/lidarlite.cpp -I../src -li2c -o example
diff --git a/src/lidarlite.h b/src/lidarlite.h
index 35343ff..c9289fc 100644
--- a/src/lidarlite.h
+++ b/src/lidarlite.h
@@ -26,7 +26,6 @@
#define LIDARLITE_H
#include <cstddef>
-#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <cstdlib>
#include <cstdio>
@@ -34,6 +33,11 @@
#include <unistd.h>
#include <errno.h>
+extern "C" {
+ #include <linux/i2c-dev.h>
+ #include <i2c/smbus.h>
+}
+
// Information taken from PulsedLight knowledge base 5-4-15
// Internal Control Registers
Please let me know if you would like me to create PR
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.