2

I am trying to connect the EV3 brick over Bluetooth to a Mac so I can use direct commands to send bytecodes. However, the Bluetooth connection remains active only through the Lego Mindstorms software. I can download programs from Mac over Bluetooth within the Lego Mindstorms software. However, once I close that app the bluetooth connection goes away. Without the Lego software open, if I try pairing EV3 to Mac, it pairs briefly and stays connected (according to Mac's preferences menu) for 2 seconds and then says "Not connected". I am using Macbook Pro early 2014 with Yosemite. I also upgraded the firmware on EV3 to 1.08. Please help.

1 Answer 1

2

Bluetooth communication from the Mac to the EV3 is done using RFCOMM. This means that the EV3 appears as a serial port on the Mac. Namely /dev/tty.EV3-SerialPort. To send and receive messages from the EV3, you read and write to this virtual file. Bluetooth will show as "connected" as soon as you open this file. You can find some code examples here.

2
  • Thank you for your response, David. Actually, with Thiago's comment I found that though the Mac preferences said the EV3 was disconnected, when I tried to send a message (play a tone) using the serial port (using Python), it connected and worked! I appreciate the examples here. They've been of great help. Commented Dec 11, 2015 at 22:42
  • Now that I've tested the Bluetooth connection, I'm trying to read a .rtf text file on the brick using Python. I'm using opFile with open_read, read_value and close all packaged into one direct command (DIRECT_COMMAND_REPLY). Now, since I'm using Python file write to write this direct command to the Bluetooth serial port, how do I get the value returned (the text value in the .rtf file) by the direct command? Python file write does not have a return value. Commented Dec 13, 2015 at 0:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.