Limor ‘Ladyada’ Fried, founder of Adafruit and maker extraordinaire, has just released a video demonstrating LIDAR (laser based distance measurement) with CircuitPython and Mu.

The source code and documentation for the library Limor demonstrates can be found on GitHub. Under the hood, it’s an I2C based API which has beed abstracted into something Pythonic. The code example included in the README (reproduced below) demonstrates how easy it is to use the LIDAR sensor with CircuitPython. In only a few lines of code it outputs data which Mu can use with its built-in plotter:

import time
import board
import busio
import adafruit_lidarlite

# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)

# Default configuration, with only i2c wires
sensor = adafruit_lidarlite.LIDARLite(i2c)

while True:
        # We print tuples so you can plot with Mu Plotter
    except RuntimeError as e:
        # If we get a reading error, just print it and keep truckin'
    time.sleep(0.01) # you can remove this for ultra-fast measurements!

Great stuff!

It’s at this point in geeky blog posts that it’s traditional to bring up sharks, lasers and Dr.Evil. Happily, I ironically understand apophasis. ;-)