Trying to read an EV3 gyro on a BrickPi2

It works fine on an EV3. Plugged the gyro (& the same cable) to port S1 of my BrickPi2 & the following program gets the same constant value, no matter how I rotate the gyro, or even if its plugged in to S1. Any thoughts?

BrickPiSetup()
BrickPi.Sensor[PORT_1] = TYPE_SENSOR_EV3_GYRO_M0 #Angle mode
BrickPiSetupSensors() # Apply settings

while True:
result = BrickPiUpdateValues() # Get sensor data
if not result:
gyro_angle = BrickPi.Sensor[PORT_1]
print(f"Gyro Angle: {gyro_angle}")
time.sleep(1)

1 Like