Main Content

stop

Add-On Required: This feature requires the MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware add-on.

Description

stop(mymotor) stops supplying power to the motor and lets the motor coast to a stop.

example

stop(mymotor,mode) stops supplying power to the motor and uses electromagnetic braking to stop the motor immediately.

example

Examples

collapse all

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

collapse all

Connection to a motor, specified as a string that represents the object created using motor.

Example: mymotor

Data Types: char

Breaking mode, specified as a logical value. With 0, the motor coasts to stop gradually. With 1, the motor brakes to stop immediately.

Example: 1

Data Types: logical

Version History

Introduced in R2015a