obniz Parts Library

iBS02IR

GitHub
iBS02IR
Usable Devices :
obniz_board
m5stickc

iBS02IR

iBS02IR by INGICS. Using infrared, It detect obstacles.

Support device

  • iBS02IR

getPartsClass(name)

// Javascript Example
const IBS02 = Obniz.getPartsClass('iBS02IR');

isDevice(BleRemotePeripheral)

Returns true if a device was found.

// Javascript Example
const IBS02 = Obniz.getPartsClass('iBS02IR');
await obniz.ble.initWait();
obniz.ble.scan.onfind = (p) => {
    if (IBS02.isDevice(p)) {
        let data = IBS02.getData(p);
        console.log(data);
    }
};
await obniz.ble.scan.startWait(null, { duplicate: true, duration: null });

getData(BleRemotePeripheral)

Returns device information if found. Returns Null if not found.

  • battery : Battery voltage
  • event : True when sensor read
// Javascript Example
const IBS02 = Obniz.getPartsClass('iBS02IR');
await obniz.ble.initWait();
obniz.ble.scan.onfind = (p) => {
    if (IBS02.isDevice(p)) {
        let data = IBS02.getData(p);
        console.log(data);
    }
};
await obniz.ble.scan.startWait(null, { duplicate: true, duration: null });

Supported from: obniz.js 3.5.0