Master / Slave communication not working between Arduino Micro boards

I needed to send MPU6050’s accelerometer and gyroscope data and voice recognition module’s voice command status flag through the HC-05 Bluetooth module to receiver Bluetooth and Arduino. But because both Bluetooth HC-05 and voice recognition module use software serials, and not more than one software serial can function at a time, I had to search for a solution. I found that one solution is to alternate the serials. But my project is a wireless head mouse project. So, to decrease the mouse cursor lag, I need HC-05 and voice recognition module V3.1 to work parallelly. So, I went to implement the Master/slave approach to use two Arduino boards (one for the collection and calculation of data from MPU and voice recognition module) and the other for just getting these values and sending this data through HC-05. But I got stuck right in the basics. I tried to send data between two interconnected Arduino Micros in Master/Slave manner which uses I2C protocols, but it didn’t work. I got nothing on the serial monitor set to 9600 bauds and “Newline” selected on the slave board’s Serial monitor. The code I used was from the Arduino examples itself.

Circuit connections between Arduino Micros:
A4->A4
A5-> A5
Gnd-> Gnd

These connections are from the Example tutorials on this website which I followed and double-checked.

I tried both Master Writer &Slave Receive, and also Master reader & Slave sender.

Master Writer & Slave Receiver sketch respectively

// Wire Master Writer
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
}

byte x = 0;

void loop()
{
  Wire.beginTransmission(4); // transmit to device #4
  Wire.write("x is ");        // sends five bytes
  Wire.write(x);              // sends one byte  
  Wire.endTransmission();    // stop transmitting

  x++;
  delay(500);
}
// Wire Slave Receiver
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Receives data as an I2C/TWI slave device
// Refer to the "Wire Master Writer" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

void setup()
{
  Wire.begin(4);                // join i2c bus with address #4
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
}

void loop()
{
  delay(100);
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
  while(1 < Wire.available()) // loop through all but the last
  {
    char c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
  Serial.println(x);         // print the integer
}

Master Reader & Slave Sender sketch respectively

// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

void setup() {
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
}

void loop() {
  Wire.requestFrom(8, 6);    // request 6 bytes from slave device #8

  while (Wire.available()) { // slave may send less than requested
    char c = Wire.read(); // receive a byte as character
    Serial.print(c);         // print the character
  }

  delay(500);
}
// Wire Slave Sender
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Sends data as an I2C/TWI slave device
// Refer to the "Wire Master Reader" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

void setup() {
  Wire.begin(8);                // join i2c bus with address #8
  Wire.onRequest(requestEvent); // register event
}

void loop() {
  delay(100);
}

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {
  Wire.write("hello "); // respond with message of 6 bytes
  // as expected by master
}

Do not cross-post!

pylon: Do not cross-post!

I didn't get replies for almost two days on this subtopic. What am I supposed to do if I can't find my answer online and nobody replies on this sub-topic and my deadline is approaching?

Circuit connections between Arduino Micros:
A4->A4
A5-> A5
Gnd-> Gnd

I2C isn’t on A4/A5 on the Micro!

I didn’t get replies for almost two days on this subtopic. What am I supposed to do if I can’t find my answer online and nobody replies on this sub-topic and my deadline is approaching?

Still no reason to cross-post.