Create connection between host computer and EV3 hardware
myev3 = legoev3(ipaddress)
that the MATLAB software can reach an EV3 brick with the specified
IP address on the network.
After you run a Simulink model on the EV3 hardware, you can use commands to stop, restart, and delete the model.
Create a connection between the MATLAB software on your host computer and the operating system on the EV3 hardware.
myev3 = legoev3('172.21.128.249')
myev3 = legoev3 with properties: ipAddress: '172.21.128.249'
The function returns a handle,
you will use as the first argument in the following commands.
To stop the model on the EV3 hardware, enter:
ans = 0
When the function has stopped the model, it returns
To restart the model on the EV3 hardware, enter:
ans = 0
When the function has restarted the model, it returns
To delete the model on the EV3 hardware, enter:
ans = 0
When the function has deleted the model, it returns
You can verify that an EV3 brick with a specific IP address is reachable on the network. For example, you can use this syntax to check that the EV3 power is on before you deploy a model to the EV3 brick.
ans = legoev3 with properties: ipAddress: '172.21.128.249'
The function returns the IP address of the reachable EV3 brick on the network.
If an EV3 brick is not reachable at the specified address, the command returns an error.
Error using legoev3 (line 60) Failed to connect to '172.21.128.250'. Please check your network settings.
ipaddress— IP address of EV3 hardware
IP address of EV3 hardware, specified as a character vector. You can get the IP address from Brick Info screen on the EV3 hardware.
myev3— Connection to specific EV3 brick
Connection to a specific EV3 brick, specified as a handle.
After creating a
myev3 handle, you can
use the handle with the following methods:
You can use
myev3 to read and write the
For example, to read the current IP address, enter:
ans = 172.21.128.249
For example, to connect to a different EV3 brick without clearing and recreating a connection, assign a new IP address to the connection:
myev3.ipAddress = '172.21.128.250'
myev3 = legoev3 with properties: ipAddress: '172.21.128.250'