This website is available for multi language.

obniz Parts Library

iBS02PIR

GitHub
iBS02PIR
Usable Devices :
obniz_board
m5stickc
obnizble
esp32
esp32gateway
m5stackbasic
ak-030
obnizble_lte
obniz_plc

iBS02PIR

INGICS社製の人感センサーです。

Support device

  • iBS02PIR

getPartsClass(name)

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

isDevice(BleRemotePeripheral)

デバイスを発見した場合、trueを返します。

// Javascript Example
const IBS02 = Obniz.getPartsClass('iBS02PIR');
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)

発見した場合にデバイスの情報を返します。発見できなかった場合にはNullを返します。

  • battery : 電池電圧
  • event : センサーに反応があるときtrue
// Javascript Example
const IBS02 = Obniz.getPartsClass('iBS02PIR');
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