start
Start motor
Syntax
Description
Examples
Control a Motor
Start a motor, change the speed and direction of the motor, and then stop the motor.
Create a connection to the EV3 brick called myev3
.
myev3 = legoev3
myev3 = legoev3 with properties: FirmwareVersion: 'V1.03E' HardwareID: [] IPAddress: [] CommunicationType: 'USB' BatteryLevel: 100 ConnectedSensors: {'touch' 'gyro' 'color' 'sonic'}
The sensor appears in the list of connected sensors.
Create a connection to a motor. Specify the letter of the EV3 output port that connects to the motor.
mymotor = motor(myev3,'A')
mymotor = motor with properties: OutputPort: 'A' Speed: 0
By default, the speed is zero.
Configure the motor to reverse at half speed.
mymotor.Speed = -50
mymotor = motor with properties: OutputPort: 'A' Speed: -50
Start the motor.
start(mymotor)
Change the direction and speed of the motor.
mymotor.Speed = 70
mymotor = motor with properties: OutputPort: 'A' Speed: 70
Stop the motor.
stop(mymotor)
Input Arguments
mymotor
— Connection to motor
object handle
Connection to a motor, specified as a string that represents the object created using motor
.
Example: mymotor
Data Types: char
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)