Hi – thanks for using MonoBrick Communication library
Start off by downloading the Monobrick Communication Library for Android. The first thing you need to do is to check if Bluetooth is turned on. This can be done by using the static property on the Bluetooth class as shown below.
If Bluetooth is not turned on use the following code to turn it on
Once Bluetooth has been turned on use the following code to get a list of paired devices
If you know the device name you can also call
Use the Bluetooth device to create a Bluetooth connection instance and create a brick class followed by opening the connection. The code below sums it all up.
var device = MonoBrick.Bluetooth<MonoBrick.EV3.Command, MonoBrick.EV3.Reply>.GetBondDevice("youDeviceName"); var connection = new Bluetooth<MonoBrick.EV3.Command, MonoBrick.EV3.Reply>(device); var brick = new MonoBrick.EV3.Brick<MonoBrick.EV3.Sensor,MonoBrick.EV3.Sensor,MonoBrick.EV3.Sensor,MonoBrick.EV3.Sensor>(connection); brick.Connection.Open();
Replace EV3 namespace with NXT namespace depending on your device
Let me know how it goes
- This reply was modified 4 years, 1 month ago by Anders Søborg.