Go Down

Topic: How to define which wires read I2C values without using wire.h (Read 343 times) previous topic - next topic


Code: [Select]
const int MPU_addr=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;

void setup(){
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)

I'm trying to define which wires I want to use for an MPU6050 (3 axis acceleromater/ gryo and thermistor) in order to clean up a project. Using wire.h, I'm using A5, A4 and D2 on the arduino which causes a lot of cross wires and I'm hoping to switch it to A6, A7 and D13 to keep them all on one side of the board. Is that possible or is there a way I can modify the "MPU_addr" to use the pins I want?


No, the I2C bus is a hardware feature and only the pins A4/A5 (on an ATmega328p based Arduino) are able to fulfill that task. The pin D2 is not used in your code so you may eliminate it if you use only this code. If it's used as an interrupt source you can switch to D3 which also has this functionality but I guess this doesn't help you with the wiring.

Go Up