Uses the lgpio library to get sensor data from TF-Luna using the Xojo programming language on the Raspberry Pi and I2C communication.
The TF-Luna is a LiDAR (Light Radar) that measures accurate, single-point distance measurement in a small package that is ideal for robotics, and obstacle detection. Attached are code from Xojo to retreive and set information on the TF-Luna, the module MDLTFLunaRev17 containing library code that is specific to the TF-Luna.
The lgpio library can be installed Raspberry Pi OS (Oct 2024) and instructions are available at http://abyz.me.uk/lg/download.html
Install instructions are:
- install Raspberry Pi OS (64-bit)
- Open a terminal and type the following commands:
- sudo apt install swig python3-dev
- sudo apt install python3-setuptools
- sudo apt install libunwind8
- wget https://github.com/joan2937/lg/archive/master.zip
- unzip master.zip
- cd lg-master
- make
- sudo make install
- create a TF-Luna example program and copy the program and libraries to the RaspberryPi Desktop
- give the executable permission to run with something like: 'sudo chmod +x TFLuna' run the program with something like: 'sudo ./TFLuna'
Below is the breadboard connections with the Raspberry Pi and TF-Luna.

A description of the button functions are shown here

