How do you turn using the inertial sensor and heading?!

Please help! My team and I have been trying to use the intertial sensor with the heading to turn 90 degrees in our autonomous. We’ve spent 2 weeks trying to figure out the code and we have had no success. All our firmware is up to date and our brain is updated to the most recent update. If anyone knows the turning code for the inertial sensors please share it! It would help everyone! Thank you

Well, what exactly are you doing? What is your code? What results are happening? Why are they undesirable?

Post I found after searching around:

3 Likes

@trontech569 Thank you very much, it is working now. But I am only able to get the robot to turn right and stop. Whenever I try and reverse the directions of the motors to turn left the robot just turns left forever and doesn’t stop. Any idea how to fix that?

You need to give more information. How exactly are you doing this? What is your code? We don’t have telepathic abilities.

3 Likes

I have now been able to get the robot to turn right 90 degrees using the code that trontech569 posted above ^. However I cannot get the robot to turn left 90 degrees now with that code. When I tried to reverse the motor direction to turn left the robot just kept tuning left without stopping. I can post pictures of the code if you want

When you reverse the motors, the value for degrees goes down. This means you will never reach 90 degrees. You have to change the wait until statement to <= -90

2 Likes

Thank you everyone for the help. We have gotten our Inertial sensors working now because of it, so thank you