Solved - Connecting LEGO EV3 to MATLAB

5 次查看(过去 30 天)
Hi there - I am a beginner and got tons of problems just finding the right buttons and sequence to get MATLAB to recognize my LEGO EV3 brick. Somehow everybody assumes the first steps and beginners get stuck at very simple things.
If you are a beginner like me these steps will spare you days of poking around!
Prerequisites:
1. Bluetooth
Install blue tooth if you do not already have it. Buying LEGO’s recommended Bluetooth adapter maybe an option if you have to go out and buy one. In my case I just bought a generic Bluetooth adapter from Amazon (Medialink USB Bluetooth Adapter - Version 4.0 Class 2).
2. LegoMindsorms LabView project environment
2.1. Just install the default EV3 environment from the Lego Mindsorms website. http://www.lego.com/en-us/mindstorms/downloads/software/ddsoftwaredownload/
2.2. Find your EV3 brick
Connect your brick using the USB cable that came with it. Power it on. Open the LabView software – looks like that:
Open one of the default Mindsorms projects – looks like that:
2.3. Name your Brick
Bottom right corner there is a window like that – name your brick there. In my case the name is MAXAI2000 (look for it in the samples below). Then Press the download button under the EV3 logo in the same window. Once you hear your brick make a sound you will see that name appear on the LCD of the brick.
Connection from MATLAB:
1. Start MATLAB
2. At the command prompt run this:
EDU>> Bluetooth('MAXAI2000', 1 )
Be patient!!! and wait. You will get something like this: From it, remember the RemoteID
Bluetooth Object : Bluetooth-MAXAI2000:1
Communication SettingsRemoteName: MAXAI2000
RemoteID: btspp://00165340B761
Channel: 1
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
3. On the top bar of MATLAB click: Apps Tab -> Instrument Control ->
Type in the Remote ID that you copied from running the Bluetooth command.
Run “Connect”.
Be patient!!! and wait. Expecting instant result and thinking that the process is hanging cost me a lot of failed attempts and frustration. 30 seconds or more response time seems to be quite normal.
You will see this.
You are connected!!
  2 个评论
Stephen Gulo
Stephen Gulo 2021-4-13
Hello @Theodore, I've already follow your instruction and it works. Now I want to verify the bluetooth connection by play beep sound like in this source:
could you tell how to do similar task since your making bluetooth connection method was different from link above. Thank you

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by