Jump to content
I2Cdevlib Forums

MPU6050 What's a point of checking for interrupt if we can just check for fifoCount ?


Max Yari
 Share

Recommended Posts

Hello everyone.
I'm quite new to Arduino and i2c so please bear with me even if my questions may have an obvious answer from your point of view.
Looking at the example of 6 axis MPU 6050 I'm trying to wrap my head around some programming decision that was made, specifically:


1) Why do we run while loop 

while (!mpuInterrupt && fifoCount < packetSize) {

 inside the main Arduino loop() instead of just simply running single interrupt flag and fifoCount check each iteration of the loop(), is that to catch new data package as absolutely soon as possible?

2) Why do we use interrupt at all, can't we just check getFIFOCount() and if > packetSize - retrieve data. I've modified the example to do just that and it seems that data is still fine, nothing borked e.t.c. I might be missing the whole point of using interrupts here, please clarify this for me if possible.

Thanks in advance!

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...