Connection to gyroscopic sensor
This object represents a connection to a single-axis
EV3 Gyro Sensor (item number 45505). To connect to an gyroscopic sensor,
create this object using the gyroSensor
function.
To measure total rotation or rate of rotation, use this object with
the functions listed in Object Functions.
Before creating an object, complete the steps described in Connections to EV3 Hardware.
Use legoev3
to
connect to, and create an object that represents, the EV3 brick. For
example:
myev3 = legoev3;
Use gyroSensor
to
connect to, and create an object that represents, a gyroscopic sensor.
For example:
mygyrosensor = gyroSensor(myev3)
mygyrosensor = gyroSensor with properties: InputPort: 2
To get data from the sensor, use the gyroSensor
object
with readRotationAngle
, readRotationRate
, and resetRotationAngle
. For
example:
readRotationAngle(mygyrosensor)
ans = 6
gyroSensor | Create connection to gyroscopic sensor |
readRotationAngle | Read rotation angle from gyroscopic sensor |
readRotationRate | Read rotation rate from gyroscopic sensor |
resetRotationAngle | Reset rotation angle to zero |