Main Content

Gyro Sensors

The gyroscopic sensor measures rotation around a single vertical axis that extends from the top and bottom of the EV3 Gyro Sensor (item number 45505).

To connect from the MATLAB® software to the gyro sensor, use the gyroSensor function to create a gyroSensor object.

  • To measure the total rotation of the sensor in degrees, use the readRotationAngle function with the gyroSensor object. Rotating the sensor clockwise increases the value. Rotating the sensor counterclockwise decreases the value. For example, if you rotate the sensor 360 degrees clockwise and 60 degrees counterclockwise, the measurement value is 300.

  • To reset the rotation measurement to zero, use the resetRotationAngle function with the gyroSensor object.

  • To measure the sensor’s rate of rotation in degrees per second, use the readRotationRate function with the gyroSensor object. Rotating the sensor clockwise produces positive values. Rotating the sensor counterclockwise produces negative values. For example, if you rotate the sensor counterclockwise one full rotation (360 degrees) every 10 seconds, the rate of rotation is -36 degrees per second.