Jump to content
I2Cdevlib Forums
Sign in to follow this  
Max Yari

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

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×