Does anybody know how to establish a bluetooth connection from a self-written iOS app to the new LEGO Mindstorms EV3 programmable brick?
I tried to do this via the scanForPeripheralsWithServices:options: method of CBCentralManager, but the brick is not recognized.
But if I enable Bluetooth in the Settings of the iPhone, then the EV3 device is displayed there. There is also an app in the AppStore from LEGO ("Commander") which talks to the brick via Bluetooth, so I think this should be possible in general (as I know, it was not possible for the previous Mindstorms NXT brick).
Does anybody have an idea how I can do this?
Thanks!
Go to Settings >> Bluetooth. Make sure Bluetooth is turned on and let your iPad search for a minute or until your EV3 Brick is listed under My Devices. Select your EV3 Brick and click Pair. Confirm the pairing on your EV3 Brick.
On your Android device, open System settings and make sure Bluetooth is turned on. Go back to Settings and open Bluetooth and select your EV3 to pair it. Confirm the passkey on both devices when requested. On the EV3, find your Android in the list of Bluetooth devices and and select it.
As said, the device isn't listed using CoreBluetooth, got it using EAcessory framework, you need to have the item "COM.LEGO.MINDSTORMS.EV3" in UISupportedExternalAccessoryProtocols in your App-Info.plist :
<EAAccessory: 0x15567180> {
connected:YES
connectionID:18565483
name: MFI Accessory
manufacturer: LEGO
modelNumber: DM240411
serialNumber:
firmwareRevision: 1.0.0
hardwareRevision: 1.0.0
protocols: (
"COM.LEGO.MINDSTORMS.EV3"
)
delegate: (null)
}
As with the Lego app, you need to first connect to the EV3 using Settings App. Then, look at the Apple EADemo sample, it show how to use EASession (encapsulate read/write stream).
Maybe sending data like the C# gathered from monobrick.dk source code (said in Mailerdaimon answer) will work... I'll get a try via Wifi (after porting C# to ObjC, long job), after that, writing to EASession might be easier. I'll update this answer when done.
You will have to wait until Lego release the SDK which hopefully contains information about the protocol. It was possible with the NXT and i think it will be possible with the EV3.
In the mean time you could try to send your messages via Wifi which is possible right now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With