Raspberry pi zero w + lidar lite v3

image_pdfimage_print
RpiLidar
3.3VRed
GNDBlack
GPIO03 (SCL)I2C SCL (Green)
GPIO02 (SDA)I2C SDA (Blue)
import smbus
import time
bus=smbus.SMBus(1)
addr=0x62
 
while True:
    bus.write_byte_data(0x62,0x00, 0x04)   
    val_high=bus.read_byte_data(0x62,0x0f)   
    val_low=bus.read_byte_data(0x62,0x10)   
    dist_cm=val_high*256+val_low
    print `dist_cm` + " cm   "
    time.sleep(1)

Maj 22/12/2018

J’ai du réinstaller le Pi 0 W et le lidar ne fonctionnait plus. Faire :

https://github.com/raspberrypi/firmware/issues/828

  1. Download the old module here.
  2. Copy this file into /boot/overlays.
  3. In /boot/config.txt add the line dtoverlay=i2c1-bcm2708 at the end.