张高兴的 Windows 10 IoT 开发笔记:ToF Sensor VL53L0X

本文约 171 字,包含 2 张图片,阅读时间约 1 分钟

QR Code

See this page on your phone

This is a Windows 10 IoT Core project on the Raspberry Pi 2/3, coded by C#.

GitHub : https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/VL53L0X

Connect

  • SDA - Pin3
  • SCL - Pin5
  • VCC - 5V
  • GND - GND

Reference

This project refered to arduion code VL53L0X.ino, because the datasheet is no useful information... So I don't know how to read and write...

Files and datasheet -> https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/VL53L0X/Reference

Screenshot

How to Use

  • First, you need to create a VL53L0X object. After that you should call InitializeAsync() to initialize.
VL53L0X sensor = new VL53L0X();
await sensor.InitializeAsync();
  • Second, Read().
// Data Struct
VL53L0XData data = sensor.Read();
// Only Distance
short dis = sensor.ReadDistance();
  • If you want to close the sensor, call Dispose().
sensor.Dispose();