Hi
Has anyone tried a working code for MPU6050 + Raspberry Pi Pico on Arduino IDE? I tried to find samples but they dont work, even the I2C scan program cant detect the MPU6050, BUT when run on Thonny on Micropython (with appropriate dependencies), it can detect and fetch values.
Thanks
Hi
can you please tell me how to connect pico to mpu6050 I cant connect it please help me
please can you help me to connect my pico to mpu6050 its been 3 weeks now I didn't find the solution to this
Updated the repo with the circuit.
I believe you didn't assign the pin to the default SDA and SDL pins, that's why in the sample program you shared, it has to be explicitly declared with custom IC values. As per pinout diagrams, the default SDA and SDL pins are GP4 and GP5 respectively.
Yes, for my case pico i2c default pins were occupied. Therefore I declared with custom IC pins.
I get an error
mpu_test:9:26: error: no matching function for call to 'TwoWire::TwoWire(int, int)'
9 | TwoWire CustomI2C0(10, 11); //important
| ^
In file included from C:\Users\gstru\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_I2CDevice.h:5,
from C:\Users\gstru\Documents\Arduino\libraries\Adafruit_BusIO/Adafruit_BusIO_Register.h:9,
from C:\Users\gstru\Documents\Arduino\libraries\Adafruit_MPU6050/Adafruit_MPU6050.h:21,
from C:\Users\gstru\Documents\Arduino\pico test\mpu_test\mpu_test.ino:4:
C:\Users\gstru\Documents\ArduinoData\packages\rp2040\hardware\rp2040\2.7.1\libraries\Wire\src/Wire.h:39:5: note: candidate: 'TwoWire::TwoWire(i2c_inst_t*, pin_size_t, pin_size_t)'
39 | TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl);
| ^~~~~~~
C:\Users\gstru\Documents\ArduinoData\packages\rp2040\hardware\rp2040\2.7.1\libraries\Wire\src/Wire.h:39:5: note: candidate expects 3 arguments, 2 provided
C:\Users\gstru\Documents\ArduinoData\packages\rp2040\hardware\rp2040\2.7.1\libraries\Wire\src/Wire.h:37:7: note: candidate: 'constexpr TwoWire::TwoWire(const TwoWire&)'
37 | class TwoWire : public HardwareI2C {
| ^~~~~~~
C:\Users\gstru\Documents\ArduinoData\packages\rp2040\hardware\rp2040\2.7.1\libraries\Wire\src/Wire.h:37:7: note: candidate expects 1 argument, 2 provided
C:\Users\gstru\Documents\ArduinoData\packages\rp2040\hardware\rp2040\2.7.1\libraries\Wire\src/Wire.h:37:7: note: candidate: 'constexpr TwoWire::TwoWire(TwoWire&&)'
C:\Users\gstru\Documents\ArduinoData\packages\rp2040\hardware\rp2040\2.7.1\libraries\Wire\src/Wire.h:37:7: note: candidate expects 1 argument, 2 provided
exit status 1
no matching function for call to 'TwoWire::TwoWire(int, int)'
I think the 3rd argument is missing.
But I don't understand what type it should be.
\ArduinoData\packages\rp2040\hardware\rp2040\2.7.1\libraries\Wire\src/Wire.h file:
TwoWire::TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl) {
_sda = sda;
_scl = scl;
_i2c = i2c;
_clkHz = TWI_CLOCK;
_running = false;
_txBegun = false;
_buffLen = 0;
}
arduino version:
1.8.19 (Windows Store 1.8.57.0)