Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Uno"
In file included from C:\Users\Memay Family\Downloads\How_to_Make_Balancing_Robot_at_home\How_to_Make_Balancing_Robot_at_home.ino:11:0:
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h: In member function 'uint8_t MPU6050::dmpGetAccel(int32_t*, const uint8_t*)':
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:580:31: warning: left shift count >= width of type
data[0] = ((packet[28] << 24) + (packet[29] << 16) + (packet[30] << 8) + packet[31]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:580:52: warning: left shift count >= width of type
data[0] = ((packet[28] << 24) + (packet[29] << 16) + (packet[30] << 8) + packet[31]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:581:31: warning: left shift count >= width of type
data[1] = ((packet[32] << 24) + (packet[33] << 16) + (packet[34] << 8) + packet[35]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:581:52: warning: left shift count >= width of type
data[1] = ((packet[32] << 24) + (packet[33] << 16) + (packet[34] << 8) + packet[35]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:582:31: warning: left shift count >= width of type
data[2] = ((packet[36] << 24) + (packet[37] << 16) + (packet[38] << 8) + packet[39]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:582:52: warning: left shift count >= width of type
data[2] = ((packet[36] << 24) + (packet[37] << 16) + (packet[38] << 8) + packet[39]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h: In member function 'uint8_t MPU6050::dmpGetQuaternion(int32_t*, const uint8_t*)':
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:604:30: warning: left shift count >= width of type
data[0] = ((packet[0] << 24) + (packet[1] << 16) + (packet[2] << 8) + packet[3]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:604:50: warning: left shift count >= width of type
data[0] = ((packet[0] << 24) + (packet[1] << 16) + (packet[2] << 8) + packet[3]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:605:30: warning: left shift count >= width of type
data[1] = ((packet[4] << 24) + (packet[5] << 16) + (packet[6] << 8) + packet[7]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:605:50: warning: left shift count >= width of type
data[1] = ((packet[4] << 24) + (packet[5] << 16) + (packet[6] << 8) + packet[7]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:606:30: warning: left shift count >= width of type
data[2] = ((packet[8] << 24) + (packet[9] << 16) + (packet[10] << 8) + packet[11]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:606:50: warning: left shift count >= width of type
data[2] = ((packet[8] << 24) + (packet[9] << 16) + (packet[10] << 8) + packet[11]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:607:31: warning: left shift count >= width of type
data[3] = ((packet[12] << 24) + (packet[13] << 16) + (packet[14] << 8) + packet[15]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:607:52: warning: left shift count >= width of type
data[3] = ((packet[12] << 24) + (packet[13] << 16) + (packet[14] << 8) + packet[15]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h: In member function 'uint8_t MPU6050::dmpGetGyro(int32_t*, const uint8_t*)':
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:637:31: warning: left shift count >= width of type
data[0] = ((packet[16] << 24) + (packet[17] << 16) + (packet[18] << 8) + packet[19]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:637:52: warning: left shift count >= width of type
data[0] = ((packet[16] << 24) + (packet[17] << 16) + (packet[18] << 8) + packet[19]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:638:31: warning: left shift count >= width of type
data[1] = ((packet[20] << 24) + (packet[21] << 16) + (packet[22] << 8) + packet[23]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:638:52: warning: left shift count >= width of type
data[1] = ((packet[20] << 24) + (packet[21] << 16) + (packet[22] << 8) + packet[23]);
^
C:\Users\Memay Family\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:639:31: warning: left shift count >= width of type
data[2] = ((packet[24] << 24) + (packet[25] << 16) + (packet[26] << 8) + packet[27]);
^
C:\Users\Memay Family\Documents\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]);
^
Sketch uses 15978 bytes (49%) of program storage space. Maximum is 32256 bytes.
Global variables use 634 bytes (30%) of dynamic memory, leaving 1414 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\\.\COM5": The system cannot find the file specified.
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
答案 0 :(得分:1)
心理调试:data
和packet
是MPU6050::dmpGetAccel
的参数,并且您试图将四个字节组合成一个单词。
您需要在uint32_t
s(而不是uint8_t
s)中进行算术运算,否则您总是会溢出值。
更改表格的所有行
data[n] = ((packet[m] << 24) + (packet[m+1] << 16) + (packet[m+2] << 8) + packet[m+3]);
到
data[n] = ((uint32_t{ packet[m] } << 24) + (uint32_t{ packet[m+1] } << 16) + (uint32_t{ packet[m+2] } << 8) + uint32_t{ packet[m+3] });