obniz Parts Library

linking

GitHub
linking
Usable Devices :
obniz_board
m5stickc
Found at :

Linking Devices

Common Parts Library for Linking Devices

This is forked project.
Thanks for https://github.com/futomi/node-linking

Usage

See how to use this library on https://github.com/futomi/node-linking.

Example Programs

Tomoru https://codesandbox.io/s/linking-tomoru-l89lu

Sizuku 6x https://codesandbox.io/s/linking-acc-406cj

wired(obniz)

Registrate lining parent class to an obniz device to search and connect linking devices.

// Javascript Example
const linking = obniz.wired("Linking");
await linking.init();
const device_list = await linking.discover({
  duration: 5000,
  nameFilter: "Tomoru"
});
if (device_list.length == 0) {
  console.log("not found");
  return;
}
device = device_list[0];
device.onconnectprogress = obj => {
  console.log(obj);
};
await device.connect();
await device.services.led.turnOn("Red", "Pattern1");

pairing

Pairing with the device is automatic when needed.
If you want to save your pairing key, use onPairedCallback

// Javascript Example
const linking = obniz.wired("Linking");
await linking.init();
const device_list = await linking.discover({
  duration: 5000,
  nameFilter: "Tomoru"
});
if (device_list.length == 0) {
  console.log("not found");
  return;
}
device = device_list[0];
device.onconnectprogress = obj => {
  console.log(obj);
};
await device.connect({
  pairingOption : {
    onPairedCallback : (keys) =>{
       //store key 
       console.log(keys);
    }
  }
});

If you want to use a pairing key after the second connection, please specify a key when you connect.

// Javascript Example
const keys = "xxxxxx"; //stored keys

const linking = obniz.wired("Linking");
await linking.init();
const device_list = await linking.discover({
  duration: 5000,
  nameFilter: "Tomoru"
});
if (device_list.length == 0) {
  console.log("not found");
  return;
}
device = device_list[0];
device.onconnectprogress = obj => {
  console.log(obj);
};
await device.connect({
  pairingOption : {
    keys : keys  
  }
});

Supported from: obniz.js 3.5.0

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers

Forum

Visit our developer’s forum to discuss and discover technologies.

Forum

Contact

Feel free to contact out support and technical team.

Contact us