iBS03R
distance sensor.
getPartsClass(name)
// Javascript Example
const IBS03R = Obniz.getPartsClass('iBS03R');
isDevice(BleRemotePeripheral)
Returns true if a device was found.
// Javascript Example
const IBS03R = Obniz.getPartsClass('iBS03R');
await obniz.ble.initWait();
obniz.ble.scan.onfind = (p) => {
if (IBS03R.isDevice(p)) {
let data = IBS03R.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
- distance: distance value;
// Javascript Example
const IBS03R = Obniz.getPartsClass('iBS03R');
await obniz.ble.initWait();
obniz.ble.scan.onfind = (p) => {
if (IBS03R.isDevice(p)) {
let data = IBS03R.getData(p);
console.log(data);
}
};
await obniz.ble.scan.startWait(null, { duplicate: true, duration: null });
Supported from: obniz.js 3.17.0