Distance Sensor in Python

Intermediate

Read the LiDAR time-of-flight distance sensor with `pybot.distance()`, display the live reading on the OLED, and apply a threshold to trigger a LED and buzzer alert.

20 min5 steps
DistanceToFSensorOLEDIntermediate
0 of 5 steps

Step 1 of 5

Connect your board

Power on your Beaver Board — the OLED will show a PIN code. Click Connect in the toolbar, choose Connect via Bluetooth, and select your board. If it's your first time, enter the PIN shown on the screen.

The LiDAR distance sensor is a separate part of your kit, not built into the board. Use the 4-pin cable to plug it into the external I2C port (the 4-pin connector labelled SDA / SCL) on the Beaver Board.