since 2021-09-20
Blinka 資料
bluepy 資料
以下 pip3 を sudo なしで使えと書かれている
pip3 install したものは .local/lib/python3.7/site-packages あたりに入る。
$ pip3 install --upgrade adafruit-blinka-bleio adafruit-circuitpython-ble $ sudo usermod -a -G bluetooth $USER $ sudo reboot
$ python3 Python 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import adafruit_ble >>> from adafruit_ble.advertising.standard import Advertisement >>> ble = adafruit_ble.BLERadio() >>> for adv in ble.start_scan(Advertisement, timeout=5): ... name = adv.complete_name ... if not name: ... continue ... if name == "ITAG": ... con = ble.connect(adv) ... print("connected") ... break ... connected >>> ble.stop_scan() >>> con <adafruit_ble.BLEConnection object at 0x752f7950> >>> con.connected True >>> con.pair <bound method BLEConnection.pair of <adafruit_ble.BLEConnection object at 0x752f7950>> >>> con.disconnect()
動いているようだ。