Gyro
-
class
devices.
Gyro
(ev3handle, layer=1, portnum=1, inputmode='angle')[source] The class to represent the EV3 gyro sensor.
Set up a gyro sensor on port number 1
>>> from pyev3.brick import LegoEV3 >>> from pyev3.devices import Gyro >>> myev3 = LegoEV3(commtype='usb') >>> mysensor = Gyro(myev3, portnum=1, inputmode='rate')
- Parameters
ev3handle (object) –
LegoEV3
instance representing the EV3 brick.layer (int) – The layer of the brick
1
or2
in a daisy-chain configuration.portnum (int) – The brick input port connected to the sensor. Possible values are
1
,2
,3
, or4
.inputmode (str) –
'angle'
angular position in deg'rate'
angular speed up to 440 deg/s'angle&rate'
angular position and rate
-
display_info
() Displays a summary with the sensor information.
-
property
inputmode
Contains the sensor input mode. Use this to change the mode on the fly (read/write).
-
property
output
Contains the sensor output based on the inputmode (read only).
integer
angle
(inputmode=’angle’)integer
rate
(inputmode=’rate’)tuple of integers (
angle
,rate
) (inputmode=’angle&rate’)