Gyro Suddenly stopped working?

If you meant doing it like this printf("sensor: %d\n", adi_analog_read(gyro)); then it gives me a value of 2147483647. @edjubuh

That would be the designated constant for PROS_ERR. add another printf right after: printf("error: %d\n", errno);

Now i am getting this image @edjubuh

@edjubuh do you have any idea why this is happening?

@Sgarg14 Do you have the gyro ADI port configured as an Analog Input or as a Gyroscope still? If you try to poll the port as an analog input while it is configured as a gyroscope then it will return PROS_ERR (2147483647) . The errno value of 0 is expected for this case, although that is different behavior than other such mismatched configuration errors and I will be updating that for the next release.

@edjubuh Do you mean like this?

printf("sensor: %d\n", adi_port_get_value(GYRO_PORT));

adi_port_set_config(GYRO_PORT, E_ADI_ANALOG_IN);

Make sure to put the adi_port_set_config() call before the printf, but yes, that should work for printing the analog value sent from the gyroscope.

@edjubuh this is whats happening now image
it just switching between 10 and 11 and nothing happens when i move the bot

@edjubuh Do you have an idea why it isnt working?

Anyone please help if you can? @edjubuh

Have you tried changing the port? A similar issue happened to my team and we had to change ports repeatedly throughout the season

yes i have tried changing the port @Terrel_T

Have you had this gyro for long? Telling from the code, it seems as thought the sensor is still present and detectable by the brain, but just isn’t functioning properly. Maybe contact VEX support for a faulty product?

Also, something similar happened with another one of my parts and VEX was (SOMEHOW) able to get me a replacement within less than a week. So it could be a viable solution depending on how close your next comp is.

i have had this gyro for about 2 months and it was working perfectly before two days ago

and our next comp is in two weeks but i only have this week to program then the driver needs his practice. @Terrel_T

Ah jeez. Maybe have your driver allocate time for practice this week and split the time. If something on the physical gyro is messed up and not the program, there’s really nothing you can do about it. It’s all on VEX support to replace it as soon as possible. Just hope it doesn’t take the usual 8 weeks. Also, did you try those previous programs alone, like a singular program that runs ONLY the gyro and sees if it returns said values?

@Terrel_T Yes i tried that as well it still doesnt change when i move the bot

What does the V5 dashboard show if you configure that port as analog input ? It should be around 1800 when stationary.