Inertial Sensor Block Code Help

I’ve tried several variations of this code to program an inertial sensor to make more accurate turns, but is always spins forever when I try to use this custom block. I’ve tried adding a wait to give it time to calibrate, removing the wait, making it print on the brain, not making it print on the brain, using inequalities, using an if block instead of a while block. However, it still spun forever (or didn’t work at all) for every trial. Please give me advice to fix it.

![Screenshot 2026-01-09 155142|690x431]
(upload://9LvZdDn65829p84YusEjHZGE0S1.png)

Trying to compare the inertial sensor rotation to an absolute number to stop turning will almost never work, you need to check to see if it’s within some number of degrees of the required target.

Okay, so do you mean that I should use an if block with an inequality?

Hello! I used a block that compared the turns. We would say the turn needed to be between 88 and 92 degrees. I would make it an almost perfect turn. Hope this helps! If you have questions reply to this and I will try to explain.

This is amazing but where do I find a define block in the building code???