BLE framework is a Unity library that you can use to easily manage the Bluetooth communication between your mobile device and a ReadBearLab BLE boards.The supported boards are:
- BLE Shield
- BLE Mini
- Blend Micro
- Blend
- BLE Nano
- RBL nRF51822
The ReadBearLab BLE boards can be attached to a micro controller such as Arduino to allow simple wireless serial communication with your mobile device.
The sample Unity project inside the folder Unity contains two sample scenes to get started using the framework.
概要 Unity製のiOS,AndroidアプリとBluetoothで繋がる自作専用ハードウェアを作りたい。 と言うシチュエーションは最近増えてきました。こうした場合はBLE(Blutooth Low Energy)経由で接続することが多いです。 過去の例だと BLE NANO RedBearLab BLE Nanoキ. Troubleshooting on iOS devices Reporting crash bugs on iOS Android. Apple A11 Bionic 2.39 GHz Hexa-core (2 Monsoon + 4 Mistral) with Neural Engine. Ambient Light Sensor, Magnetometer; Wifi + Bluetooth 4.0 + (LTE, 3G Cellular. The iPad 3 has been shown to be capable of render-to-texture effects such as.
- RobotServer: build this scene for testing BleMini with Arduino Mega + Adafruit Motor Shield with 4 DC Motors. The code for Arduino is inside the folder Arduino/RobotClient. Read this article for details on how to wire the Adafruit Motor Shield with 4 DC Motors: https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/overview
- MeteoStation: build this scene for a sample app for temperature and humidity sensor reading. The hardware setup is BleMini with Arduino Mega + Sparkfun RTH03 sensor. Read this article for details on how to wire the humidity and temperature sensor: https://learn.sparkfun.com/tutorials/rht03-dht22-humidity-and-temperature-sensor-hookup-guide/allYou can find the code for Arduino inside the folder Arduino/MeteoServer.In both hardware configurations (RobotClient and MeteoServer) the BleMini Rx and Tx pins must be wired respectively to the Tx1 18 and Rx1 19 digital pins of the Arduino Mega 2560.
Before building the Unity project for Android targets, you need to generate the android plugin using the AndroidPlugin project. You can open this project using Android Studio, then click on Run 'copyPlugin' to generate and copy the plugin in the BleFramework/Assets/Plugin/Android folder.Now you are ready to build the Unity project for Android targets.VERY IMPORTANT FOR ANDROID: When running the android example app the first time you have to grant permission for Location in the Android apps settings menu. No popup is prompt asking for permission and you have to grant the Location permission manually. If you don't give Location permission the BLE scan will return empty result.
As mentioned before Android plugin is generated by the AndroidPlugin Android Studio's project. You can find the code inside the 'bleframework/src' subfolder.
As regard iOS you can find the plugin source code inside the folder Unity/Assets/Plugins/iOS/BLE.
If you want to modify the plugins you can just modify the source code in these folders.
BLE examples between unity and esp32. this repo used Unity Store Asset 'Bluetooth LE for iOS, tvOS, android'.
You must to buy Unity Store Asset below to run this repo's BLE code for Unity.
Bluetooth LE for iOS, tvOS, androidhttps://www.assetstore.unity3d.com/#!/content/26661/directpurchase?aid=1101lGs4 (Unity Asset Store Link)
SimpleTest
- Rotate cube by notify it include quaternion.
- Search and auto-connect to notify device it need to match 3 infomation. Device Name, Service UUID, Characteristic UUID.
- notify data is 16bytes array. it is serialized quaternion(4 floats).
- Arduino folder include code for arduino-esp32
Arduino BLE_IMU
- this code is needed bno055, it is IMU.
- Get quaternion by IMU(bno055).
- Send data as notify.