Display the list of BLE devices in the select box of HTML

Make things

Use the obniz Board to search for and display a list of BLE devices in the vicinity.

Materials

  • BLE devices(unspecified, More than one is better.)
  • obniz Board
  • portable battery
  • Mobile phone or PC

How to make

Hardware

The BLE is wireless, so you don’t need to connect anything to the pins of the obnizBoard.

Please connect only USB and turn on the power.

Software

In order to use the BLE, you need to initialize it first. The initialization code is as follows.

await obniz.ble.initWait();

To search for BLE devices around you, use the following code

You can change the search conditions by specifying the parameters in {}.

obniz.ble.scan.start({duration: 30});

You can read more information about BLE here.

When you start the program, you will see a list of device addresses in the list.
Discovered devices will be added sequentially over time.

Program