Gesture controlled robot compilation error

D:\Documents\Arduino\libraries\I2Cdev/I2Cdev.h:37:10: fatal error: driver/i2c.h: No such file or directory

#include <driver/i2c.h>


compilation terminated.

I am trying to make a gesture controlled robot and I am using an open source code. I get this error even though I have installed all the required libraries. Any help would be appreciated.

#include <SPI.h>
#include <RF24.h>
#include <Wire.h>
#include <I2Cdev.h>
#include <MPU6050.h>

MPU6050 mpu;
int16_t ax, ay;

int data[2];

RF24 radio(9, 10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup(void)

void loop(void)
  mpu.getMotion6(&ax, &ay);

  data[0] = map(ax, -17000, 17000, 300, 400);
  data[1] = map(ay, -17000, 17000, 100, 200);
  radio.write(data, sizeof(data));

Which board do you have selected from the Arduino IDE's Tools > Board menu?

Please post a link to where you found that code. It may provide additional context that will enable us to help you.

@pert I am using a UNO.
Here is the link to the code:

I have edited it a little bit to remove the comment lines and the gyroscope data.

The problem is that there are multiple variants of the "I2Cdev" library and you somehow managed to install the one for the ESP32 microcontroller. That variant of the library is not compatible with the Uno, which is the reason for the error.

So the first thing you need to do is remove the bad installation of the library. Do that by deleting this folder:


Please be very careful when deleting things from your computer. When in doubt, back up!

Now you will need to install the correct library. There is no information about where to find the specific version used by the author in the sketch itself and I didn't have time to watch the video or hunt for other documentation. Because they are using Arduino Web Editor, I can make an educated guess that they are using the pre-installed library from Library Manager, which is this library:

Maybe you already installed it? If not, you can install it by following these instructions:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.
  2. Wait for the update to finish.
  3. In the "Filter your search" field, type "MPU6050"
  4. Press Enter.
  5. Scroll down through the list of libraries until you see "MPU6050 by Electronic Cats". Click on it.
  6. Click the Install button.
  7. Wait for the installation to finish.
  8. Click the Close button.

Now you can try compiling your sketch again.

@pert Thank you so much. This solved my problems.

You're welcome. I'm glad to hear it's working now. Enjoy!

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.