English | 🇯🇵 日本語はこちら
bleP5 is a Bluetooth Low Energy (BLE) communication library for the Processing environment.
It enables you to connect to multiple BLE devices, read and write data, and receive notifications using concise and intuitive code.
- Scanning, connecting to, and disconnecting from BLE devices
- Discovering and interacting with services and characteristics
- Subscribing to Notify / Indicate and handling callbacks
- Supports simultaneous connections to multiple devices
- Utility functions for converting between byte arrays and common data types (int, float, boolean, etc.)
- A PC with built-in BLE functionality or a USB BLE dongle
- Processing 4.0 or later
- Supported OS:
- Windows: Tested
- macOS: Not tested
- Linux: Not tested
- Download the ZIP file from the Releases page of this repository, and unzip it.
- Place the
bleP5/folder into thelibraries/directory of your Processing sketchbook. - Restart Processing, open a sample sketch, and run it.
A wide range of examples is provided in the examples/ folder.
They cover everything from basic usage for beginners to multi-device management and toio integration.
| Sample Name | Description |
|---|---|
| ex01_ScanConnect_Sync_ByName | Synchronously scan for a device by name and connect |
| ex02_ScanConnect_Sync_ByAddress | Synchronously scan for a device by address and connect |
| ex03_ScanConnect_Async_ByName | Asynchronously scan for a device by name and connect |
| ex04_ScanCallbacks | Demonstrates scan callbacks (start, stop, found, updated) |
| ex05_ConnectionCallbacks | Callback handling for connect and disconnect events |
| ex06_Read | Read from a characteristic |
| ex07_Write | Write to a characteristic |
| ex08_Notify | Receive notifications using Notify |
| ex09_Indicate | Receive indications using Indicate |
| ex10_UUIDs | Retrieve and list UUIDs of services, characteristics, and descriptors |
| ex11_Properties | List the properties of characteristics |
| ex12_Characteristic | Use the Characteristic class for easier operations |
| ex13_Descriptor | Access and read/write descriptors for enabling/disabling notifications |
| ex14_ByteUtilsConversion | Convert byte arrays into int, float, boolean, and more |
| ex15_DebugMessage | Enable and display debug messages |
| ex16_MultiDeviceConnection | Connect to multiple BLE devices |
| ex17_BLEUart_with_nRF52 | Communicate with nRF52 device using BLE-UART (includes an Arduino sketch) |
| ex18_toioCoreCube | Prototype for connecting to and controlling toio Core Cube |
This library internally uses SimpleBLE via JNA.
It is built on version 0.7.3, which has been confirmed to work reliably with Processing.
Precompiled simpleble-c binaries (DLL/dylib/so) for each supported OS are bundled with this library.
You can build bleP5.jar using the build.bat script (for Windows).
Before running the script, make sure to update the paths to PROCESSING_JAVA_HOME and PROCESSING_CORE_JAR in the file.
MIT License
- Sunao Hashimoto
- GitHub: @kougaku
bleP5 は、Processing 環境で Bluetooth Low Energy(BLE)通信を簡単に扱うためのライブラリです。
複数のBLEデバイスとの接続、データの読み書き、通知の受信を、簡潔かつ直感的なコードで実現できます。
- BLEデバイスのスキャン、接続、切断の制御
- サービスおよびキャラクタリスティックの検出と操作
- Notify / Indicate の受信およびコールバック処理
- 複数のデバイスと同時に接続可能
- バイト配列と各種データ型(int、float、booleanなど)との相互変換を行うユーティリティ関数を用意
- nRF52 デバイス や toio Core Cube 用のサンプルスケッチを同梱
- BLE機能を備えたPCまたはUSB BLEドングル
- Processing 4.0 以降
- 対応OS:
- Windows:動作確認済み
- macOS:未検証
- Linux:未検証
- このリポジトリの Releases ページからZIPファイルをダウンロードし、展開します。
bleP5/フォルダを Processing スケッチブックのlibraries/フォルダに配置します。- Processing を再起動し、サンプルスケッチを開いて実行します。
examples/ フォルダには多数のサンプルが収録されています。
初心者向けの基本的な使い方から、複数デバイスの管理や toio との連携まで幅広く対応しています。
| サンプル名 | 説明 |
|---|---|
| ex01_ScanConnect_Sync_ByName | デバイス名で同期的にスキャンし、接続する基本例 |
| ex02_ScanConnect_Sync_ByAddress | アドレス指定で同期的にスキャンし、接続する例 |
| ex03_ScanConnect_Async_ByName | デバイス名で非同期スキャンし、接続する例 |
| ex04_ScanCallbacks | スキャン時のコールバック(開始・停止・発見・更新)をデモ |
| ex05_ConnectionCallbacks | 接続/切断イベントのコールバック処理例 |
| ex06_Read | キャラクタリスティックからの読み取り処理 |
| ex07_Write | キャラクタリスティックへの書き込み処理 |
| ex08_Notify | Notify を使用した通知の受信処理 |
| ex09_Indicate | Indicate を使用した通知(インディケーション)の受信処理 |
| ex10_UUIDs | サービス/キャラクタリスティック/ディスクリプタのUUID取得と一覧表示 |
| ex11_Properties | キャラクタリスティックのプロパティを列挙 |
| ex12_Characteristic | Characteristic クラスを使った操作例 |
| ex13_Descriptor | 通知の有効/無効を切り替えるためのディスクリプタの操作 |
| ex14_ByteUtilsConversion | バイト列から int、float、boolean などへの変換例 |
| ex15_DebugMessage | デバッグメッセージの有効化と表示 |
| ex16_MultiDeviceConnection | 複数のBLEデバイスへの接続と通信処理 |
| ex17_BLEUart_with_nRF52 | nRF52 BLE-UARTデバイスとの通信例(Arduinoスケッチ付き) |
| ex18_toioCoreCube | toio Core Cube との接続と制御のプロトタイプ(モーター・音声制御など) |
このライブラリは内部で SimpleBLE を JNA 経由で使用しています。
Processing 環境で安定して動作することが確認されたバージョン 0.7.3 を使用しています。
対応OS向けの simpleble-c バイナリ(DLL / dylib / so)はすべてこのライブラリに同梱されています。
build.bat スクリプトを使用して bleP5.jar をビルドできます(Windows のみ)。
実行前に、スクリプト内の PROCESSING_JAVA_HOME および PROCESSING_CORE_JAR のパスを適切に設定してください。
MIT License
- 橋本直(Sunao Hashimoto)
- GitHub: @kougaku