resetRotationAngle

Reset rotation angle to zero

Syntax

resetRotationAngle(mygyrosensor)

Description

example

resetRotationAngle(mygyrosensor) resets the rotation angle measurement to zero. You can use this function to reset the value that the readRotationAngle function returns to zero.

Examples

collapse all

After measuring the angle of rotation using a gyroscopic sensor, you can reset the measurement value to zero.

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 the gyroscopic sensor called mygyrosensor.

mygyrosensor = gyroSensor(myev3)
mygyrosensor = 

  gyroSensor with properties:

    InputPort: 2

Measure the rotation, in degrees, since the creation of the connection to the sensor.

angle = readRotationAngle(mygyrosensor)
ans =

           59

The sensor has rotated 59 degrees clockwise.

Reset the measurement to zero.

resetRotationAngle(mygyrosensor)

Input Arguments

collapse all

Connection to gyroscopic sensor, specified as a string that represents the object created using gyroSensor.

Example: mygyrosensor

Data Types: double