Gyro robot code disable

I try to rotate by gyro. But if i turn on the program robot code dissapear.

Can you post a link to your code, or share a snippet of it? Without more information, it’s going to be hard to help figure out what is going on. :slightly_smiling_face:

It sounds like you weren’t having this issue before, but are now having it when you added the gyro code? Is that correct?

That symptom can happen when you reference an object that hasn’t been instantiated yet. Perhaps you forgot to instantiate your Gyro before attempting to read from it?
Seeing your code would answer that question quickly.

Yes. I will send link to code.

IDK how to upload to GitHub.

The last line of code in the image you posted references the gyro but I do not see the gyro being created anywhere. That would cause a NullPointerException and kill your code.


Create u mean "gyro = new Gyro() " ?

Something like that but Gyro is an interface. You will need a class like, ADXRS450_Gyro, and create one of those like, “gyro = new ADXRS450_Gyro();”. Exactly what you will do depends on which gyro your are using and how it is connected to the roboRio.

The easiest thing to try first is to just comment out the line(s) of code that try to use the gyro and see if the issue goes away.


1 Like

Ty I will try

Tyvm . GYRO works perfectly . Do you know how to set sensibility to 0-360 degrees?

Depends which gyro you’re using. Do you know which one it is or have a picture of it?