Hand Free Mouse Sketch Upload Issue

I'm trying to use a Pro Micro and MPU9250 sensor as a hands free mouse. It compiles but with an error and will not upload. Here is the compiling error:

"Missing 'maintainer' from library in /tmp/387977701/custom/Quaternion"

I've tried using other Quaternion libraries, but they won't compile.

Uploading I get "Executing Command: exit status 1" b/c of maintainer

I am using a sketch I found here. The changes I made were to add these libraries: <Quaternion.h> <BMP180.h> <I2Cdev.h> <MPU9250.h> and removed: "MPU6050_9Axis_MotionApps41.h"

Here's the sketch:

#include <Quaternion.h>

#include <BMP180.h>
#include <I2Cdev.h>
#include <MPU9250.h>


#include <Mouse.h>
#include "Wire.h"

MPU9250 mpu;

#define OUTPUT_READABLE_YAWPITCHROLL

#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;

bool dmpReady = false;  // set true if DMP init was successful
uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount;     // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer

Quaternion q;           // [w, x, y, z]         quaternion container
VectorFloat gravity;    // [x, y, z]            gravity vector
float euler[3];         // [psi, theta, phi]    Euler angle container
float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector
float yaw, pitch, roll;

int left_button_pin = 9; // Left button
int right_button_pin = 10; // right button
int leftClickFlag = 0;
const int sensitivity = 30;
float vertZero, horzZero;
float vertValue, horzValue;  // Stores current analog output of each axis

volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
void dmpDataReady() {
    mpuInterrupt = true;
}

// ================================================================
// ===                      INITIAL SETUP                       ===
// ================================================================

void setup() 
{
  Wire.begin();                                // join I2C bus (I2Cdev library doesn't do this automatically)
  Serial.begin(115200);                       // initialize serial communication
  while (!Serial);                            // wait for Leonardo enumeration, others continue immediately
  mpu.initialize();
  devStatus = mpu.dmpInitialize();
   if (devStatus == 0) 
   {
      mpu.setDMPEnabled(true);                // turn on the DMP, now that it's ready
      attachInterrupt(0, dmpDataReady, RISING);     // enable Arduino interrupt detection
      mpuIntStatus = mpu.getIntStatus();
      dmpReady = true;                        // set our DMP Ready flag so the main loop() function knows it's okay to use it
      packetSize = mpu.dmpGetFIFOPacketSize();      // get expected DMP packet size for later comparison
  } 
  else 
  {                                          // ERROR!        1 = initial memory load failed         2 = DMP configuration updates failed        (if it's going to break, usually the code will be 1)
      Serial.print(F("DMP Initialization failed (code "));
      Serial.print(devStatus);
      Serial.println(F(")"));
  }
  pinMode(LED_PIN, OUTPUT);                 // configure LED for output
  pinMode(left_button_pin, INPUT);
  pinMode(right_button_pin, INPUT);
  yaw = 0.0;
  pitch = 0.0;
  roll = 0.0;
  vertZero = 0;
  horzZero = 0;
}

// ================================================================
// ===                    MAIN PROGRAM LOOP                     ===
// ================================================================

void loop() {

    if (!dmpReady) return;                                                    // if programming failed, don't try to do anything
    mpuInterrupt = true;
    fifoCount = mpu.getFIFOCount();                                           // get current FIFO count
    if ((mpuIntStatus & 0x10) || fifoCount == 1024)                           // check for overflow (this should never happen unless our code is too inefficient)
    {
        mpu.resetFIFO();                                                      // reset so we can continue cleanly
        Serial.println(F("FIFO overflow!"));
    } 
    else if (mpuIntStatus & 0x01)                                             // otherwise, check for DMP data ready interrupt (this should happen frequently)
    {    
        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();        // wait for correct available data length, should be a VERY short wait
        mpu.getFIFOBytes(fifoBuffer, packetSize);                             // read a packet from FIFO
        fifoCount -= packetSize;                                              // track FIFO count here in case there is > 1 packet available
        #ifdef OUTPUT_READABLE_YAWPITCHROLL                                               // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
            yaw = ypr[1] /PI * 180;
            pitch = ypr[2] /PI * 180;
            roll = ypr[0] /PI * 180;
            Serial.print("ypr\t");
            Serial.print(yaw);
            Serial.print("\t");
            Serial.print(pitch);
            Serial.print("\t");
            Serial.println(roll);
        #endif
        blinkState = !blinkState;                                             // blink LED to indicate activity
        vertValue = yaw - vertZero;
        horzValue = roll - horzZero;
        vertZero = yaw;
        horzZero = roll;   
        if (vertValue != 0)
          Mouse.move(0, vertValue * sensitivity, 0);                                      // move mouse on y axis
        if (horzValue != 0)
          Mouse.move(horzValue * sensitivity, 0, 0);                                      // move mouse on x axis

        if ((digitalRead(left_button_pin))&&(!leftClickFlag))
        {
          leftClickFlag = 1;
          Mouse.press(MOUSE_LEFT);
        }
        else if ((digitalRead(left_button_pin))&&(leftClickFlag))
        {
          leftClickFlag = 0;
          Mouse.release(MOUSE_LEFT);
        }
        if (digitalRead(right_button_pin))
        {
          Mouse.click(MOUSE_RIGHT);
        }
    }
}

Thanks and keep in mind I'm a noob

"maintainer" is an item in the library.properties file. It should not be required for a library to compile.

If there is a .properties file, look at it to see if it is damaged and you can repair it. Or just delete it. The library should work fine without that file.

For more info on .properties, check out Arduino IDE 1.5: Library specification · arduino/Arduino Wiki · GitHub

maintainer is a required library.properties field, thus the error.

It's not a case of a damaged library.properties, the author of the library simply didn't add that field. I submitted a pull request 9 months ago to fix this issue:

Sadly, the author of the library has not bothered to take a few seconds to click the "merge" button so that their library will actually work.

The solution MorganS proposed of deleting library.properties will solve the issue:

I removed the library.properties file but it caused more problems, now I have this error: 'VectorFloat' does not name a type

./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -logger humantags -fqbn arduino:avr:micro -build-cache /tmp -build-path /tmp/343034181/build -verbose -prefs runtime.tools.avr-gcc.path=./opt/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2 -prefs runtime.tools.avrdude.path=./opt/tools/avrdude/6.3.0-arduino14 -prefs runtime.tools.arduinoOTA.path=./opt/tools/arduinoOTA/1.2.1 -libraries /tmp/343034181/custom -libraries /tmp/343034181/pinned /tmp/343034181/MPU9250YPRMOUSE.ino

Using library mouse_1_0_1 at version 1.0.1 in folder: /home/ubuntu/opt/libraries/latest/mouse_1_0_1

Using library HID at version 1.0 in folder: /home/ubuntu/opt/cores/arduino/avr/libraries/HID

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino:72:1: error: 'VectorFloat' does not name a type

VectorFloat gravity; // [x, y, z] gravity vector

^

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino: In function 'void setup()':

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino:99:19: error: 'class MPU9250' has no member named 'dmpInitialize'

devStatus = mpu.dmpInitialize();

^

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino:106:24: error: 'class MPU9250' has no member named 'dmpGetFIFOPacketSize'

packetSize = mpu.dmpGetFIFOPacketSize(); // get expected DMP packet size for later comparison

^

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino: In function 'void loop()':

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino:144:17: error: 'class MPU9250' has no member named 'dmpGetQuaternion'

mpu.dmpGetQuaternion(&q, fifoBuffer);

^

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino:145:17: error: 'class MPU9250' has no member named 'dmpGetGravity'

mpu.dmpGetGravity(&gravity, &q);

^

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino:145:32: error: 'gravity' was not declared in this scope

mpu.dmpGetGravity(&gravity, &q);

^

/tmp/343034181/MPU9250YPRMOUSE.ino/MPU9250YPRMOUSE.ino.ino:146:17: error: 'class MPU9250' has no member named 'dmpGetYawPitchRoll'

mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);

^

exit status 1

It appears you have substituted an advanced library with DMP by another one which does not have DMP. Hence you should not attempt to use the DMP.

Feargaill:
The changes I made were to add these libraries: <Quaternion.h> <BMP180.h> <I2Cdev.h> <MPU9250.h> and removed: "MPU6050_9Axis_MotionApps41.h"

Why did you do that?

pert:
Why did you do that?

My senor is a MPU9250 + 280

I tried uploading with the 6050 library but nothing happened

Go back to the basic examples that came with the library you are actually using. Then build up from there.