Vex Coding Studio Gyro endless counting

First of all, make sure that the wire is fully inserted into 3-wire port and connected to the Gyro with proper polarity (black wire is Ground).

Then try to change your preauton as follows and see if it helps:

void preauton()
{
  vex::task::sleep(300);
  Gyro.startCalibration();
  while(Gyro.isCalibrating())
  {
    vex::task::sleep(1);
  }
}

V5 has a quirk, where reading values of sensors, connected to legacy 3-wire ports (analog and digital), were returning 0 if you try to read them right after V5 startup.

So if you are trying running autonomous right after program starts you would need to delay reading those sensors for a short period of time to let it properly initialize.

More details are in this topic:

Finally, you can edit your original post (pencil button) and put [code]...[/code] tags around your code for better readability.

2 Likes