This was a project to demonstrate the connection between a BLE Adafruit microcontroller and Unity.
- Goal of the project is to demonstrate that any BLE microcontroller will be able to connect to a unity project
- The main example of the BLE Unity library connects a RFDuino module to a unity project, but any BLE device should be able to be connected.
- To Demonstrate this, I will have the device connect via bluetooth LE to the Unity Game runnung on a phone.
- As the device is tilted a cube on the unity program will also tilt.
- This is the proof of concept mainly to show connection with Unity.
The most important part of the unity code is the connection to BLE
private string _FullUID = "6e40****-b5a3-f393-e0a9-e50e24dcca9e"; //Default UUID from adaFruit nrf52
private string _serviceUUID = "0001"; // service characteristic
private string _readCharacteristicUUID = "0003";
private string _writeCharacteristicUUID = "0002";
private string deviceToConnectTo = "_TimsBluefruit52"; //change to name given to module on Arduino code
- This is what is defines the device, the FullUID is the UART service definition
- The name of the device is what is defined in the arduino code
- Unity is subscribing to the UART serial read of the arduino and parsing out the XYZ read from the accelerometer.
- The block on the screen in turn changes color to what the LED shows on the RGB arduino
BLE_Unity.fzz
Thursday, May 2 2019, 14:46:02
Label | Part Type | Properties |
---|---|---|
LED1 | RGB LED (com. anode, rbg) | package 5 mm [THT]; polarity common anode; pin order rbg; rgb RGB |
Part1 | Triple Axis Accelerometer Breakout - ADXL335 | chip ADXL; axes 3 (x, y, z) |
Part2 | Adafruit Feather nRF52 | variant variant 1; part # Adafruit #3406 |
Amount | Part Type | Properties |
---|---|---|
1 | RGB LED (com. anode, rbg) | package 5 mm [THT]; polarity common anode; pin order rbg; rgb RGB |
1 | Triple Axis Accelerometer Breakout - ADXL335 | chip ADXL; axes 3 (x, y, z) |
1 | Adafruit Feather nRF52 | variant variant 1; part # Adafruit #3406 |
Exported with Fritzing 0.9.3- http://fritzing.org
Will only work with specified BLE device, will add selection in future development