Fifo warning causing serial writing misorder .. Help me out i am desperate

Hi everyone;

I am 17 years old . I am trying to learn all kinds of sensor. I used stm32f4 and done some serious codding before . But now i cant finish a project because of 1 bug or 1 error. Just please help me out with this one . :slightly_frowning_face:

I am reading quaternion values from mpu6050. I am building a navigation circuit so i need rotation calculations to be repeatable .

I realize that TeaPot DMP example is producing right values. Everything okey. But there is an error which says

C:\Users\\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:639:52: warning: left shift count >= width of type

     data[2] = ((packet[24] << 24) + (packet[25] << 16) + (packet[26] << 8) + packet[27]);

This is the reason that i cant pull values corect order. If you struggle with IMU’s before you must you might encounter something like that. Please help me on this one . Because i cant think any solitions. Today i spent 7 hours for solving this issue. And thats no joking .Here is the DMP code

That's not an error, it's a warning. It's very important to understand the difference. An error is something that prevents compilation from completing. A warning is just the compiler telling you "hey, here's something you might want to take a look at". You should always try to fix all warnings in your own code when possible but sometimes you will encounter warnings in libraries that are easier to just ignore rather than making the effort to fix someone else's code.

If you're on an eight bit Arduino, then by default, arithmetic is done on sixteen bit signed integers.
Shifting sixteen bits left by sixteen bits or more means bits simply drop into the bit-bucket, and are lost.
Casting the item being shifted to a 32 bit signed representation before shifting avoids this.

Shifting sixteen bits left by sixteen bits or more means bits simply drop into the bit-bucket, and are lost.

Shouldn’t that be “bit-septic tank”, like when flushing, a buffer? :grin:

AWOL:
If you're on an eight bit Arduino, then by default, arithmetic is done on sixteen bit signed integers.
Shifting sixteen bits left by sixteen bits or more means bits simply drop into the bit-bucket, and are lost.
Casting the item being shifted to a 32 bit signed representation before shifting avoids this.

no i am using mega and still same mistake occours. :frowning:

The Mega is an eight bit AVR.

AWOL:
The Mega is an eight bit AVR.

i thought it was 16 bit. so my warning has no meaning then . it may not the reason of my problem .

See reply #2