I ma using an MPU6050 with Ardunio Uno R3 board. I have tested MPU6050 libraries by Adafruit and Electronic Cats (Jeff Rowberg?) and have successfully read accelerometer, gyroscope and temperature values.
However, I have run into problems while using an example MPU6050_DMP6
provided by Electronics Cat MPU6050 library. This example requires ToxicLibs
to be installed in order to run properly. I have downloaded the toxiclibs-complete-0021.zip
from the URL Releases · postspectacular/toxiclibs · GitHub specified in the example sketch. When I add this library using Sketch-->Include Library-->Add .ZIP Library-->toxiclibs-complete-0021.zip
, I get the following error:
Error: 13 INTERNAL: Library install failed: archive is not valid: multiple files found in zip file top level
Then unzipped the folder toxiclibs-complete-0021.zip and copied just the folder toxiclibs-complete-0021/toxiclibscore
to the Arduino/libraries/
folder where folders of other libraries are present. Next I tried to compile the example sketch MPU6050_DMP6
, but still I get errors.
The example sketch is as follows:
// I2C device class (I2Cdev) demonstration Processing sketch for MPU6050 DMP output
// 6/20/2012 by Jeff Rowberg <jeff@rowberg.net>
// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
//
// Changelog:
// 2012-06-20 - initial release
/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright (c) 2012 Jeff Rowberg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================
*/
import processing.serial.*;
import processing.opengl.*;
import toxi.geom.*;
import toxi.processing.*;
// NOTE: requires ToxicLibs to be installed in order to run properly.
// 1. Download from https://github.com/postspectacular/toxiclibs/releases
// 2. Extract into [userdir]/Processing/libraries
// (location may be different on Mac/Linux)
// 3. Run and bask in awesomeness
ToxiclibsSupport gfx;
Serial port; // The serial port
char[] teapotPacket = new char[14]; // InvenSense Teapot packet
int serialCount = 0; // current packet byte position
int synced = 0;
int interval = 0;
float[] q = new float[4];
Quaternion quat = new Quaternion(1, 0, 0, 0);
float[] gravity = new float[3];
float[] euler = new float[3];
float[] ypr = new float[3];
void setup() {
// 300px square viewport using OpenGL rendering
size(300, 300, OPENGL);
gfx = new ToxiclibsSupport(this);
// setup lights and antialiasing
lights();
smooth();
// display serial port list for debugging/clarity
println(Serial.list());
// get the first available port (use EITHER this OR the specific port code below)
String portName = Serial.list()[0];
// get a specific serial port (use EITHER this OR the first-available code above)
//String portName = "COM4";
// open the serial port
port = new Serial(this, portName, 115200);
// send single character to trigger DMP init/start
// (expected by MPU6050_DMP6 example Arduino sketch)
port.write('r');
}
void draw() {
if (millis() - interval > 1000) {
// resend single character to trigger DMP init/start
// in case the MPU is halted/reset while applet is running
port.write('r');
interval = millis();
}
// black background
background(0);
// translate everything to the middle of the viewport
pushMatrix();
translate(width / 2, height / 2);
// 3-step rotation from yaw/pitch/roll angles (gimbal lock!)
// ...and other weirdness I haven't figured out yet
//rotateY(-ypr[0]);
//rotateZ(-ypr[1]);
//rotateX(-ypr[2]);
// toxiclibs direct angle/axis rotation from quaternion (NO gimbal lock!)
// (axis order [1, 3, 2] and inversion [-1, +1, +1] is a consequence of
// different coordinate system orientation assumptions between Processing
// and InvenSense DMP)
float[] axis = quat.toAxisAngle();
rotate(axis[0], -axis[1], axis[3], axis[2]);
// draw main body in red
fill(255, 0, 0, 200);
box(10, 10, 200);
// draw front-facing tip in blue
fill(0, 0, 255, 200);
pushMatrix();
translate(0, 0, -120);
rotateX(PI/2);
drawCylinder(0, 20, 20, 8);
popMatrix();
// draw wings and tail fin in green
fill(0, 255, 0, 200);
beginShape(TRIANGLES);
vertex(-100, 2, 30); vertex(0, 2, -80); vertex(100, 2, 30); // wing top layer
vertex(-100, -2, 30); vertex(0, -2, -80); vertex(100, -2, 30); // wing bottom layer
vertex(-2, 0, 98); vertex(-2, -30, 98); vertex(-2, 0, 70); // tail left layer
vertex( 2, 0, 98); vertex( 2, -30, 98); vertex( 2, 0, 70); // tail right layer
endShape();
beginShape(QUADS);
vertex(-100, 2, 30); vertex(-100, -2, 30); vertex( 0, -2, -80); vertex( 0, 2, -80);
vertex( 100, 2, 30); vertex( 100, -2, 30); vertex( 0, -2, -80); vertex( 0, 2, -80);
vertex(-100, 2, 30); vertex(-100, -2, 30); vertex(100, -2, 30); vertex(100, 2, 30);
vertex(-2, 0, 98); vertex(2, 0, 98); vertex(2, -30, 98); vertex(-2, -30, 98);
vertex(-2, 0, 98); vertex(2, 0, 98); vertex(2, 0, 70); vertex(-2, 0, 70);
vertex(-2, -30, 98); vertex(2, -30, 98); vertex(2, 0, 70); vertex(-2, 0, 70);
endShape();
popMatrix();
}
void serialEvent(Serial port) {
interval = millis();
while (port.available() > 0) {
int ch = port.read();
if (synced == 0 && ch != '$') return; // initial synchronization - also used to resync/realign if needed
synced = 1;
print ((char)ch);
if ((serialCount == 1 && ch != 2)
|| (serialCount == 12 && ch != '\r')
|| (serialCount == 13 && ch != '\n')) {
serialCount = 0;
synced = 0;
return;
}
if (serialCount > 0 || ch == '$') {
teapotPacket[serialCount++] = (char)ch;
if (serialCount == 14) {
serialCount = 0; // restart packet byte position
// get quaternion from data packet
q[0] = ((teapotPacket[2] << 8) | teapotPacket[3]) / 16384.0f;
q[1] = ((teapotPacket[4] << 8) | teapotPacket[5]) / 16384.0f;
q[2] = ((teapotPacket[6] << 8) | teapotPacket[7]) / 16384.0f;
q[3] = ((teapotPacket[8] << 8) | teapotPacket[9]) / 16384.0f;
for (int i = 0; i < 4; i++) if (q[i] >= 2) q[i] = -4 + q[i];
// set our toxilibs quaternion to new data
quat.set(q[0], q[1], q[2], q[3]);
/*
// below calculations unnecessary for orientation only using toxilibs
// calculate gravity vector
gravity[0] = 2 * (q[1]*q[3] - q[0]*q[2]);
gravity[1] = 2 * (q[0]*q[1] + q[2]*q[3]);
gravity[2] = q[0]*q[0] - q[1]*q[1] - q[2]*q[2] + q[3]*q[3];
// calculate Euler angles
euler[0] = atan2(2*q[1]*q[2] - 2*q[0]*q[3], 2*q[0]*q[0] + 2*q[1]*q[1] - 1);
euler[1] = -asin(2*q[1]*q[3] + 2*q[0]*q[2]);
euler[2] = atan2(2*q[2]*q[3] - 2*q[0]*q[1], 2*q[0]*q[0] + 2*q[3]*q[3] - 1);
// calculate yaw/pitch/roll angles
ypr[0] = atan2(2*q[1]*q[2] - 2*q[0]*q[3], 2*q[0]*q[0] + 2*q[1]*q[1] - 1);
ypr[1] = atan(gravity[0] / sqrt(gravity[1]*gravity[1] + gravity[2]*gravity[2]));
ypr[2] = atan(gravity[1] / sqrt(gravity[0]*gravity[0] + gravity[2]*gravity[2]));
// output various components for debugging
//println("q:\t" + round(q[0]*100.0f)/100.0f + "\t" + round(q[1]*100.0f)/100.0f + "\t" + round(q[2]*100.0f)/100.0f + "\t" + round(q[3]*100.0f)/100.0f);
//println("euler:\t" + euler[0]*180.0f/PI + "\t" + euler[1]*180.0f/PI + "\t" + euler[2]*180.0f/PI);
//println("ypr:\t" + ypr[0]*180.0f/PI + "\t" + ypr[1]*180.0f/PI + "\t" + ypr[2]*180.0f/PI);
*/
}
}
}
}
void drawCylinder(float topRadius, float bottomRadius, float tall, int sides) {
float angle = 0;
float angleIncrement = TWO_PI / sides;
beginShape(QUAD_STRIP);
for (int i = 0; i < sides + 1; ++i) {
vertex(topRadius*cos(angle), 0, topRadius*sin(angle));
vertex(bottomRadius*cos(angle), tall, bottomRadius*sin(angle));
angle += angleIncrement;
}
endShape();
// If it is not a cone, draw the circular top cap
if (topRadius != 0) {
angle = 0;
beginShape(TRIANGLE_FAN);
// Center point
vertex(0, 0, 0);
for (int i = 0; i < sides + 1; i++) {
vertex(topRadius * cos(angle), 0, topRadius * sin(angle));
angle += angleIncrement;
}
endShape();
}
// If it is not a cone, draw the circular bottom cap
if (bottomRadius != 0) {
angle = 0;
beginShape(TRIANGLE_FAN);
// Center point
vertex(0, tall, 0);
for (int i = 0; i < sides + 1; i++) {
vertex(bottomRadius * cos(angle), tall, bottomRadius * sin(angle));
angle += angleIncrement;
}
endShape();
}
}
Here are the error messages that I get:
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:144:18: error: variable or field 'serialEvent' declared void
void serialEvent(Serial port) {
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:144:25: error: expected ')' before 'port'
void serialEvent(Serial port) {
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:32:1: error: 'import' does not name a type; did you mean 'qsort'?
import processing.serial.*;
^~~~~~
qsort
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:33:1: error: 'import' does not name a type; did you mean 'qsort'?
import processing.opengl.*;
^~~~~~
qsort
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:34:1: error: 'import' does not name a type; did you mean 'qsort'?
import toxi.geom.*;
^~~~~~
qsort
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:35:1: error: 'import' does not name a type; did you mean 'qsort'?
import toxi.processing.*;
^~~~~~
qsort
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:43:1: error: 'ToxiclibsSupport' does not name a type
ToxiclibsSupport gfx;
^~~~~~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:45:1: error: 'Serial' does not name a type
Serial port; // The serial port
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:46:5: error: decomposition declaration cannot be declared with type 'char'
char[] teapotPacket = new char[14]; // InvenSense Teapot packet
^~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:46:5: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:46:5: error: empty decomposition declaration
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:46:8: error: expected initializer before 'teapotPacket'
char[] teapotPacket = new char[14]; // InvenSense Teapot packet
^~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:51:6: error: decomposition declaration cannot be declared with type 'float'
float[] q = new float[4];
^~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:51:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:51:6: error: empty decomposition declaration
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:51:9: error: expected initializer before 'q'
float[] q = new float[4];
^
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:52:19: error: conversion from 'Quaternion*' to non-scalar type 'Quaternion' requested
Quaternion quat = new Quaternion(1, 0, 0, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:54:6: error: decomposition declaration cannot be declared with type 'float'
float[] gravity = new float[3];
^~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:54:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:54:6: error: empty decomposition declaration
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:54:9: error: expected initializer before 'gravity'
float[] gravity = new float[3];
^~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:55:6: error: decomposition declaration cannot be declared with type 'float'
float[] euler = new float[3];
^~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:55:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:55:6: error: empty decomposition declaration
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:55:9: error: expected initializer before 'euler'
float[] euler = new float[3];
^~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:56:6: error: decomposition declaration cannot be declared with type 'float'
float[] ypr = new float[3];
^~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:56:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:56:6: error: empty decomposition declaration
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:56:9: error: expected initializer before 'ypr'
float[] ypr = new float[3];
^~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde: In function 'void setup()':
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:58:6: error: redefinition of 'void setup()'
void setup() {
^~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPU6050_DMP6.ino:165:6: note: 'void setup()' previously defined here
void setup() {
^~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:60:20: error: 'OPENGL' was not declared in this scope
size(300, 300, OPENGL);
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:60:5: error: 'size' was not declared in this scope
size(300, 300, OPENGL);
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:60:5: note: suggested alternative: 'Wire'
size(300, 300, OPENGL);
^~~~
Wire
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:61:5: error: 'gfx' was not declared in this scope
gfx = new ToxiclibsSupport(this);
^~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:61:15: error: expected type-specifier before 'ToxiclibsSupport'
gfx = new ToxiclibsSupport(this);
^~~~~~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:64:5: error: 'lights' was not declared in this scope
lights();
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:64:5: note: suggested alternative: 'gets'
lights();
^~~~~~
gets
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:65:5: error: 'smooth' was not declared in this scope
smooth();
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:65:5: note: suggested alternative: 'short'
smooth();
^~~~~~
short
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:68:20: error: 'class HardwareSerial' has no member named 'list'
println(Serial.list());
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:68:5: error: 'println' was not declared in this scope
println(Serial.list());
^~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:68:5: note: suggested alternative: 'printf'
println(Serial.list());
^~~~~~~
printf
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:71:30: error: 'class HardwareSerial' has no member named 'list'
String portName = Serial.list()[0];
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:77:5: error: 'port' was not declared in this scope
port = new Serial(this, portName, 115200);
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:77:5: note: suggested alternative: 'word'
port = new Serial(this, portName, 115200);
^~~~
word
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:77:16: error: expected type-specifier before 'Serial'
port = new Serial(this, portName, 115200);
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde: In function 'void draw()':
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:88:9: error: 'port' was not declared in this scope
port.write('r');
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:88:9: note: suggested alternative: 'word'
port.write('r');
^~~~
word
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:93:5: error: 'background' was not declared in this scope
background(0);
^~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:93:5: note: suggested alternative: 'round'
background(0);
^~~~~~~~~~
round
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:96:5: error: 'pushMatrix' was not declared in this scope
pushMatrix();
^~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:97:15: error: 'width' was not declared in this scope
translate(width / 2, height / 2);
^~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:97:26: error: 'height' was not declared in this scope
translate(width / 2, height / 2);
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:97:5: error: 'translate' was not declared in this scope
translate(width / 2, height / 2);
^~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:109:10: error: decomposition declaration cannot be declared with type 'float'
float[] axis = quat.toAxisAngle();
^~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:109:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:109:10: error: empty decomposition declaration
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:109:13: error: expected initializer before 'axis'
float[] axis = quat.toAxisAngle();
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:110:12: error: 'axis' was not declared in this scope
rotate(axis[0], -axis[1], axis[3], axis[2]);
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:110:12: note: suggested alternative: 'exit'
rotate(axis[0], -axis[1], axis[3], axis[2]);
^~~~
exit
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:110:5: error: 'rotate' was not declared in this scope
rotate(axis[0], -axis[1], axis[3], axis[2]);
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:110:5: note: suggested alternative: 'rename'
rotate(axis[0], -axis[1], axis[3], axis[2]);
^~~~~~
rename
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:113:5: error: 'fill' was not declared in this scope
fill(255, 0, 0, 200);
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:113:5: note: suggested alternative: 'ftell'
fill(255, 0, 0, 200);
^~~~
ftell
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:114:5: error: 'box' was not declared in this scope
box(10, 10, 200);
^~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:120:5: error: 'rotateX' was not declared in this scope
rotateX(PI/2);
^~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:122:5: error: 'popMatrix' was not declared in this scope
popMatrix();
^~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:126:16: error: 'TRIANGLES' was not declared in this scope
beginShape(TRIANGLES);
^~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:126:5: error: 'beginShape' was not declared in this scope
beginShape(TRIANGLES);
^~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:126:5: note: suggested alternative: 'blinkState'
beginShape(TRIANGLES);
^~~~~~~~~~
blinkState
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:127:5: error: 'vertex' was not declared in this scope
vertex(-100, 2, 30); vertex(0, 2, -80); vertex(100, 2, 30); // wing top layer
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:131:5: error: 'endShape' was not declared in this scope
endShape();
^~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:132:16: error: 'QUADS' was not declared in this scope
beginShape(QUADS);
^~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde: At global scope:
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:144:18: error: variable or field 'serialEvent' declared void
void serialEvent(Serial port) {
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:144:25: error: expected ')' before 'port'
void serialEvent(Serial port) {
^~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde: In function 'void drawCylinder(float, float, float, int)':
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:207:16: error: 'QUAD_STRIP' was not declared in this scope
beginShape(QUAD_STRIP);
^~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:207:5: error: 'beginShape' was not declared in this scope
beginShape(QUAD_STRIP);
^~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:207:5: note: suggested alternative: 'blinkState'
beginShape(QUAD_STRIP);
^~~~~~~~~~
blinkState
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:209:9: error: 'vertex' was not declared in this scope
vertex(topRadius*cos(angle), 0, topRadius*sin(angle));
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:213:5: error: 'endShape' was not declared in this scope
endShape();
^~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:218:20: error: 'TRIANGLE_FAN' was not declared in this scope
beginShape(TRIANGLE_FAN);
^~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:221:9: error: 'vertex' was not declared in this scope
vertex(0, 0, 0);
^~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:232:20: error: 'TRIANGLE_FAN' was not declared in this scope
beginShape(TRIANGLE_FAN);
^~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved202362-9670-1dhdxqt.lzxw/MPU6050_DMP6/MPUTeapot.pde:235:9: error: 'vertex' was not declared in this scope
vertex(0, tall, 0);
^~~~~~
exit status 1
Compilation error: variable or field 'serialEvent' declared void
What could be wrong? Do I need to install something else also for this code to work?
I am using Arduino IDE 2.1.0 on Ubuntu Linux 20.0.4 along with Arduino Uno R3.
Thanks for any help.