Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
External Accessory Framework?
-
Are you saying the protocol string MUST be declared in the plist file. Otherwise it is impossible to set the it programmatically within the app?
Yes, that's one of the security mechanisms of iOS. Certain things need to be declared in the Info.plist file and can't be changed at runtime. This is also used for things like location access, background audio, push notifications, etc.
-
@JonB Using the
cb
module is unfortunately not an option for a Bluetooth 2.1 MFi device. It only works with Bluetooth 4 (BLE). -
@JonB said:
have youe tried the
cb
module?cb
module only works with Bluetooth LE devices (4.0). But the Lego brick is on Bluetooth v2.1 ... -
I tried a bit more with the brick connected to the iPad. I was able to see the brick. But the session creation failed silently by return
None
. The code is as follows (after your sample code):accessories = EAAccessoryManager.sharedAccessoryManager().connectedAccessories() accessory = accessories[0] print accessory EASession = ObjCClass('EASession') session = EASession.alloc().initWithAccessory_forProtocol_(accessory, 'COM.LEGO.MINDSTORMS.EV3') print session
The output is
<EAAccessory: 0x17020a210> { connected: YES connectionID: 27234188 name: MFI Accessory manufacturer: LEGO modelNumber: DM240411 serialNumber: firewareRevision: 1.0.0 harewareRevision: 1.0.0 protocols: ( "COM.LEGO.MINDSTORMS.EV3" ) delegate: (null) } None
Notice that the last
None
is the printing result ofsession
. Is this because that the external framework setting is not in Pythonista'sinfo.plist
? -
@omz Is there a place I can find the
cb
module reference? It doesn't seem to be included in the latest beta's in-app docs. -
@Gerzer Sorry, I didn't notice that I accidentally removed that while moving some things around in the documentation – will be back in the next build.
-
@ywangd if you do get pythonista to talk to a Mindstorms brick, make sure to post the code, I'd love to see what I can do with this! I haven't touched my brick in about a year, but I wonder if I could get pythonista to control the brick's motors, or even monitor sensor input! I'd be really cool to read something like the ultrasonic sensor input on iOS.
-
This guy seems to have it working http://youtu.be/tZn9DQtC0So it looks like he has code running on a Mac that talks to EV3
-
@Webmaster4o said:
This guy seems to have it working http://youtu.be/tZn9DQtC0So it looks like he has code running on a Mac that talks to EV3
This is different from what I'd like to achieve. It used a Mac as a bridge between iOS and EV3 so that iOS was not directly talking to the EV3. I have done similar things as well.
On the iOS side I created a socket client in Pythonista and talk to a server running on Mac that forwards commands from iOS to EV3. A few libraries are available to control an EV3 from a PC. The one I used is called MonoBrick.
What I'd like to do now is to avoid the PC bridge and let iOS directly control the EV3. However, it does NOT seem to be possible from within Pythonista due to the
info.plist
setting. A communication session could NOT be created (though Pythonista was able to discover the existence of EV3). It seems that a dedicated app is needed to achieve the goal. -
That's a shame.
-
@omz Great, thanks!
-
Using my raspberry pi as a bridge to EV3 now.
-
Do you guys have a repo of code for connecting Pythonista --> Raspberry Pi --> Lego EV3? This would be interesting to collaborate on.
-
No, I'm using https://github.com/topikachu/python-ev3 with the ev3dev software on the ev3.
-
Has anyone tried personal hotspot tethering with Bluetooth? That’s the way I used to do it until my data plan changed and I didn’t have the ability to host a hotspot.