Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Thanks for the help! I've looked through the checklist that RowanP gave me and fixed anything that I thought might have been wrong, including switching to the 3.3V pin for power on the Uno. I've also used your code and it appears to still only give 0s, but when I rotate the sensor about the y-axis the code gets stuck in the State :: Wait case and only prints periods (but the heartbeat light doesn't stop). Do you have any idea why? Commented Jul 23, 2021 at 16:06
  • @TobiasGuo, as others have said, the chip could be damaged by a 5 V supply. While 5 V is within the absolute maximum rating of 6 V, it's outside the recommended operating voltage. Do you have level shifters on SCL, SDA and ADO? Try replacing the period print with Serial.println(Wire.available()); to see how many bytes it manages to read. Commented Jul 24, 2021 at 11:25
  • @TobiasGuo, you could also print and test the return value of each Wire.endTransmission(). Commented Jul 24, 2021 at 11:34
  • @TobiasGuo, did you get it working? I noticed from your question about accelerometer values that you changed the code, i.e. disabled the SLEEP mode without performing a reset because the reset re-enables SLEEP mode (Section 3, PWR_MGMT_1 register, page 8), and used keep-alive with Wire.endTransmission(false) before requesting data. Commented Jul 24, 2021 at 17:09
  • 1
    Thanks! That seems to have fixed the problem! I also switched to using the I2Cdev library and that helped streamline the process of communicating with the sensors, but now my MPUs are actually giving me the correct output! Commented Jul 26, 2021 at 17:21