Gyro Sensor Block

The Gyro Sensor block gets data from the Gyro Sensor. You can measure the rotation rate or rotation angle and get a Numeric output. You can also compare the sensor data to a Threshold Value to get a Logic (True or False) output.

See Using the Gyro Sensor for more information about what the Gyro Sensor does, the data that it provides, and programming examples.
Tips and Tricks
The Gyro Sensor block outputs data with a Data Wire. See Using the Gyro Sensor for other ways to use the Gyro Sensor that don’t require a data wire.
Choose the Sensor Port and Mode


Port Selector
Mode Selector
Inputs
Outputs

Use the Port Selector on the top of the block to make sure that the sensor port number (1, 2, 3, or 4) matches the port on the EV3 Brick that the Gyro Sensor is connected to.

Use the Mode Selector to select the mode for the block. The Inputs and Outputs available will change depending on the mode.
Modes
Measure – Angle


The Measure – Angle mode outputs the rotation angle in Angle. The angle is measured relative to the last time the sensor was reset. Use the Reset mode to reset the angle to 0.
Measure – Rate


The Measure – Reflected Light Intensity mode outputs the light intensity in Light."
Measure – Angle and Rate


The Measure – Angle and Rate mode outputs the rotation angle in Angle and the rotation rate in Rate.
Compare – Angle


The Compare – Angle mode compares the rotation angle to the Threshold Value using the selected Compare Type. The True/False result is output in Compare Result, and the rotation angle is output in Angle.
Compare – Rate


The Compare – Rate mode compares the rotation rate to the Threshold Value using the selected Compare Type. The True/False result is output in Compare Result, and the rotation rate is output in Rate.
Reset


The Reset mode resets the rotation angle of the sensor to 0 (zero). Measurements of the rotation angle measure the motion relative to the last time the sensor was reset.
Tips and Tricks
The rotation angle is computed by repeatedly adding rotation rate readings over time. Small inaccuracies in the rotation rate will add up over time and cause the rotation angle to “drift”. Resetting the rotation angle to 0 clears the error and defines a new starting point for future angle measurements.
Inputs and Outputs
The inputs available for the Gyro Sensor block will depend on the mode selected. You can enter the input values directly into the block. Alternatively, the input values can be supplied by Data Wires from the outputs of other Programming Blocks.
InputTypeAllowed ValuesNotes
Compare Type Numeric0 - 50: = (Equal to)
1: ≠ (Not Equal to)
2: > (Greater than)
3: ≥ (Greater than or Equal to)
4: < (Less than)
5: ≤ (Less than or Equal to)
Threshold Value NumericAny numberValue to compare sensor data to
The outputs available will depend on the mode selected. To use an output, use a Data Wire to connect it to another Programming Block.
OutputTypeNotes
Angle NumericRotation angle in degrees.
Measured from the last reset.
Reset with the Reset mode.
Rate NumericRotation rate in degrees per second.
Compare Result LogicTrue/False result of a Compare mode.
Gyro
Quick links