obniz Parts Library

tm511

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

TM511

BLE enabled acceleration sensor.

isDevice(BleRemotePeripheral)

Returns true if a device was found.

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

getData(BleRemotePeripheral)

Reading a acceleration data from BLE advertisement

  • x,y,z Acceleration
  • battery Battery Level
// Javascript Example
const TM511 = Obniz.getPartsClass('TM511');
await obniz.ble.initWait();
obniz.ble.scan.onfind = (p) => {
    if (TM511.isDevice(p)) {
        const data = TM511.getData(p);
        console.log(data);
    }
};
await obniz.ble.scan.startWait(null, { duplicate: true, duration: null });

Supported from: obniz.js 3.5.0