Why the i2c (MASTER reader/SLAVE writer) is not working ??

Hi familly , i hope you are fine , by the way i have a probleme whene i want connect two arduino i2c and working by master reader / slave sender and this the simulation in proteus ISIS

and this the code from WIRE library of arduino

/ 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(100);
}
// 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
}

and when i run the simulation i get this symbol in the virtual monitor

and also when i change the value send it by the slave i get other symbol in the virtual monitor .

Crosspost. This was posted in the French group a week ago.

Pete

Delta_G:
Maybe you should ask the folks at Proteus why their crappy simulator isn't working. This is the place to find out about projects on the Arduino.

Are those resistors on your SDA / SCL lines going to ground? It's hard to tell in your picture but that's what it looks like. Those should be pull-UP resistors.

DO you have a common ground between the two boards? Does Proteus even check for that?

The ground is automatically connected by proteus
MASTER writer / SLAVE reader work fine , But I want MASTER reader / SLAVE writer

el_supremo:
Crosspost. This was posted in the French group a week ago.

Pete

I haven't get any solution

Delta_G:
Yeah, because people see that this is about Proteus and not Arduino and they move on. We all know how crappy that simulator can be. Which brings us back to the question, if the problem is in Proteus then why don't you ask the Proteus people?

You're using well tested example code, so it's probably not that.

Please can give a simulator best than proteus that can simulate arduino project .

Delta_G:
Get a real Arduino and some wires and components. Forget simulators. They are putting you behind and causing you to waste time chasing problems that don't exist in the real world.

Or, again, go ask the Proteus people since the problem seems to be with that. Maybe they know something about what bugs or issues exist with their stuff and can help you get your simulation working. Although, that doesn't mean that when you translate it to a real board you're not going to end up doing the whole thing all over again because simulators aren't going to work like the real thing all the time.

OK thanks :slight_smile: