ESP32 error: i2c driver not installed
Fazeli24 opened this issue · comments
Hi, i'm trying to use the mpu6050 libary for my ESP32 Dev Module Board. I have connected all Pins like this:
3.3v = VCC
GND = GND
SCL = SCL
SDA = SDA
I first extracted the master .zip file and then copied both the MPU6050 and i2cdevlib folders from i2cdevlib-master/ESP32_ESP-IDF to Arduino/libraries. I was able to successfully upload this code:
`
#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050.h"
MPU6050 mpu;
int16_t gyroX, gyroRate;
float gyroAngle=0;
unsigned long currTime, prevTime=0, loopTime;
void setup() {
mpu.initialize();
Serial.begin(9600);
}
void loop() {
currTime = millis();
loopTime = currTime - prevTime;
prevTime = currTime;
gyroX = mpu.getRotationX();
gyroRate = map(gyroX, -32768, 32767, -250, 250);
gyroAngle = gyroAngle + (float)gyroRate*loopTime/1000;
Serial.println(gyroAngle);
}
`
But when running the code I get this error over serial:
E (11561) err: esp_err_t = 259
E (11564) i2c: i2c_master_cmd_begin(1426): i2c driver not installed
Does anyone know how to fix this error?