I want to transmit a 1 or 0 byte with I2C from a slave to a master

Hello!I need your help so i have kind of an plant waterring robot and on one arduino i have connected a motor shield and a sevomotor and on the other arduino i have connected a humidity sensor and a water pump and other kind of sensors and this arduino i wann make it a master and the other one a slave so when the slave activates the servomotor and moves the humidity and pump wont activate and create a mess but i dont know how i will let here the code for the slave but i only wrote the motor part and what i want you to do is to help me create a basic program for other arduino and develop the program for this arduino.it dosent have to be sowething complicated just the basic stuff si i can develop it on the future.
Heres the code

#include <Servo.h>
#include<Wire.h>
Servo myservo;
byte inainte;
byte inceput;
byte inapoi;
void setup() {
  Wire.begin(8);

  myservo.attach(5);
    inainte = 240;
    inceput=254;
    inapoi=186;
    Serial.begin(9600);

}
byte x=1;
void loop() {
  int nr=0;
  Serial.write(inceput);
    Serial.write(1);
    Serial.write(inainte);
    Serial.write(40);
    Serial.write(inceput);
    Serial.write(2);
    Serial.write(inainte);
    Serial.write(30);
    delay(200);
  Serial.write(inceput);
    Serial.write(1);
    Serial.write(inainte);
    Serial.write(0);
    Serial.write(inceput);
    Serial.write(2);
    Serial.write(inainte);
    Serial.write(0);
  delay(500);
  myservo.write(90);

  delay(5500);//main
  delay(100);
  myservo.write(180);
  delay(500);
  Serial.write(inceput);
    Serial.write(1);
    Serial.write(inainte);
    Serial.write(110);
    Serial.write(inceput);
    Serial.write(2);
    Serial.write(inainte);
    Serial.write(90);
  delay(500);
}
void requestEvent(byte x) {
  Wire.write(x); // respond with message of 6 bytes
  // as expected by master
}

this is for the slave

Before anyone helps you, they will want to be sure that it is not a waste of time. It might be a waste of time if, after you get it working, you figure out you need something different.

So please explain your project in more detail. A diagram would be useful.

I can't understand an 8 line run on sentence. Sorry.

I agree. I also have some important questions.

  1. Why are you using 2 Arduino?
  2. How far apart are these 2 Arduino?
  3. How can a servo "move" the humidity?

If English is not your first language, try using online translation.

first of all yes,english isnt my first languange but i want to type rapidly so i dont have time to use a translator

Why is that helpful? You need people to understand you. If you don't have the time, I guess I don't either. Good luck with your project.

You do only have to type it once...

1.i dont have any more pins available on the master arduio
2.the arduinos are like 5 cm apart
3.the servo will move the humidity sensor out from the soil and the regular motors will drive the ansembly to the next plant

thx but this is my first time using this forum and i dont know whats going on here

i dont even know if i can edit the question

There is a forum introduction guide for that.

can you give me a link or something?

Just read the forum guide and then ask it in a new message. Don't bother to edit the original.

Okay, even though you must have purposely skipped over it, because the forum software enforces that...

It's not really about rules, it's about posting in a way that people can actually help.

I'm quoting this to emphasize one point, you have to do the coding and post it. Then we help. Not, we post code that we think you could use.

This is the most common reason that beginners give for using a second Arduino. It is a bad reason to use 2 Arduino. What happens next is that the beginner has problems getting the 2 Arduino to communicate and so they post a question on the forum asking for help to get the 2 Arduinos to communicate. Does this sound familiar?

The answer is to use only 1 Arduino. There is almost always a way to use fewer pins so that you do not run out. If that can't be done, there are ways to give the Arduino more pins.

Post a schematic showing everything that is connected to the master Arduino and the second arduino. Post links to the product pages or data sheets of each component that is connected. The forum can then help you figure out how to free up some pins or add some new pins so that a second arduino is not needed.

so what are you saying is that i need to do both codes and post them there but the problem is that i have a competition and i have until 11th december and i will try to make the program then and i will post it here

I don't understand. Really... sorry but you really have an English language problem. What you posted makes no sense in this language. I can only guess. Please use machine translation.

i cant make a schematic but i can type some of them here:
ON THE MAIN BOARD (plusivo arduino uno)
-lcd shield
-soil humidity sensor
-water pump
-relay for the water pump
-buzzer
-neopixel bar
-vibration sensor
-flame sensor
-temp and humidity sensor
ON THE SECONDARY BOARD(science meow "arduino uno"
-motor shield
-2 dc motors
-servomotor

i realy cant rely on translate since i am a romanian ad the translated text would make even less logic but you cant write here what did you understand and then i will tell you if its correct