Displaying 2 different Arduino boards on the same display

Hellow everyone…i have a question if u cant hlep me.

I use Arduino UNO and MEGA boards.

I tryed to dipley on the same lcd_i2c a counter wich come from mega2560 and a temperature(dht11 sensor) from atmega328, both of them on different rows ofc. if i run them individual there is no problem…when i connect them together i get everything but only what i need no.

Connections are like this…MEGA and UNO 5V and GND are comune with LCD_I2C and from I2C the SCL and SDA are comune with slc and sda from MEGA and UNO

This is the code for UNO

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <dht.h>

dht DHT;

#define DHT11_PIN 2

LiquidCrystal_I2C lcd(0x3F, 20, 4);

byte grade[8]={
B00010,
B00101,
B00010,
B00000,
B00000,
B00000,
B00000,
};

void setup()
{
lcd.init();
lcd.backlight();
lcd.createChar (0,grade);
}

void loop()
{
int chk = DHT.read11(DHT11_PIN);
delay(100);

lcd.setCursor(0,2);
lcd.print("temperatura ");
lcd.print(DHT.temperature);
lcd.print(char(0));
lcd.print(“C”);

}

and for MEGA

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 20, 4);

int val =0;
int canter;

void setup()
{
Serial.begin(9600);

pinMode(0, INPUT);

lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print(" Nivel UNU “);
lcd.setCursor(0,1);
lcd.print(” Nivelul DOI ");

}

void loop()
{
int nr = digitalRead(0);
delay(100);

lcd.setCursor(0,3);
lcd.print(" Credit ");
lcd.print(canter);
lcd.print(“RON”);

if(nr==0)
{
canter = canter +1;
Serial.print(" Credit curent= ");
Serial.println(canter);
}

delay(20);

}

PS: Im new on your website and i use arduino from a short period of time…and sorry for my bad English :smiley:

You need to:

  1. Read the forum rules about how to properly post code.

  2. Pick one of those Arduinos to handle the display and let the other one send its data to that one to tell it to put it on the display.