Get_sonsor error: Invalid sensor data


#1

I try to run the python EV3 gyro, color sensor, or ultrasound and I get the following error
"get_sonsor error: Invalid sensor data"
The sensor is connected to port 1, and I have tried multiple cables, and multiple sensors.

I have tested that the motor position program functions fine with the ev3 motors.

I have tried running on the Scratch, but no sensor reading there either.

Anyone have any ideas??

Hardware v: 3.2.1
Firmware 1.4.3


#2

When you configure for a sensor (using set_sensor_type), it takes some time before there are any valid sensor values available. Most sensors (other than EV3 sensors) shouldn’t take more than maybe 0.1 seconds to get configured (most of the EV3 sensors take several seconds).

See this example for a way to try: except: to prevent the program from crashing. Here is another way to consider, where the program won’t continue until there is valid sensor data available.


#3

Thanks for the reply.

I have tested all ports, and the problem only persists on sensor port 1, on the other 3 ports, reading start appearing after a few seconds, but every time I change t back to port 1, no output appears.

Any suggestions?


#4

I tested the EV3 Infrared sensor on sensor port 1, and it’s working great for me (using this example program). It takes a few seconds to configure the sensor, but then it properly displays the values from the sensor.