obniz Parts Library

M5StickC_ToF

GitHub
M5StickC_ToF
Usable Devices :
obniz_board
m5stickc
Found at :
秋月電子通商

M5StickC_ToF

The distance sensor for the M5StickC with built-in laser distance sensor VL53L0X.

It measures 30mm~2000mm.

wired(obniz, {[scl, sda, vcc, gnd, i2c]})

connect to the obniz Board.
When using M5StickC, You do not need to assign pins.

// JavaScript Examples
var sensor = obniz.wired("M5StickC_ToF");
var distance = await sensor.getWait();
console.log(distance);

When using other devices, assign vcc and gnd as appropriate pins.

name type required default description
scl number(obniz Board io) no   scl of I2C
sda number(obniz Board io) no   sda of I2C
i2c object no   obniz i2c object
// JavaScript Examples
var sensor = obniz.wired("M5StickC_ToF", {scl:26, sda:0});
var distance = await sensor.getWait();
console.log(distance);

[await] getWait()

get the distance(mm) once.

// JavaScript Examples
var sensor = obniz.wired("M5StickC_ToF", {scl:26, sda:0});
var distance = await sensor.getWait();
console.log(distance);

Supported from: obniz.js 3.5.0