Task: Design and build a wired &/or wireless network connecting at least two processors I²C I2C is a serial protocol for two-wire interface to connect low-speed devices like microcontrollers, EEPROMs, A/D and D/A converters, I/O interfaces and other similar peripherals in embedded systems. It was invented by Philips and now it is used by almost all major IC manufacturers. The I 2C bus is a very popular and powerful bus used for communication between a master (or multiple masters) and a single or multiple slave devices. Each I2C slave device needs an address. I2C uses only two wires: SCL (serial clock) and SDA (serial data). SDA & SLC Well first I had to find SDA & SCL pins. For this assignment I have used 4 satshakit boards, that I were modified a bit, but the pinout was more that less the same. In the picture below you can see schematic of the board, that I have made for the output week I have circled the SDA and SCL pins. Here you can see where the SDA and SCL pins on satshakit board placed. Well now we have to connect all like in the image on the top, but in our case we have only one master. And don't forget to share the GND! In the picture below you can see how I have conneted the satshakits. Okay here you can see how I have connected the satshakits 2 satshakits on the right side are made by in this FabAcademy course(In the Input and the Output weeks) me and 2 other on the left not xD Programming Well I had 4 satshakit with LEDs an pin 13, So I have decided to make a bit Interpreter. If I type 0101, the LEDs on the 2nd nad 4th satshakit should go on and if I type 1111 all LED should go on and 0000 turns all LEDs off. So to make satshakit communicate with I²C I have used the WIRE library that comes with the Arduino IDE. You will ses my code explained below.
            #include <Wire.h> //import the wire Lib.
            #define S1 11 // so here we define the IDs for the 3 slaves
            #define S2 12
            #define S3 13
            #define LEDP 13 // define the LED pin
            String bsend;

            void setup() {
              Wire.begin();        // join i2c bus (address optional for master)
              Serial.begin(9600); //here we decalre Serial at 9600 baudrate for the input
              pinMode(LEDP,OUTPUT);// set LED pin as an output
            }
            
            void loop() {
              if (Serial.available() > 0) // If we have some input
              {
                bsend = Serial.readString(); // we read it as String
                /*
                  So one thing I have to mention here, we have write a BIN input(4bit)
                */
                
                Serial.println(bsend); // debugging
                send(bsend); // call the send(input) function
              }
            
            }
       void send(String input){

           if(input.charAt(0) == '1'){ // okay here we check the character on 3 place, if it's 1, transmit 1
                   Wire.beginTransmission(S1); // transmit to device 1
                  Wire.write(1);              // sends 1
                  Wire.endTransmission();    // stop transmitting
            
           }else if(input.charAt(0) == '0' ){ //if it's 0, transmit 0
                   Wire.beginTransmission(S1); // transmit to device 1
                  Wire.write(0);              // sends 0
                  Wire.endTransmission();    // stop transmitting
            
            }
            //---------------------------------------------------------------

            if(input.charAt(1) == '1'){ // okay here we check the character on 3 place, if it's 1, transmit 1
                Wire.beginTransmission(S2); // transmit to device 2
                Wire.write(1);              // sends 1
                Wire.endTransmission();    // stop transmitting
          
            }else if(input.charAt(1) == '0' ){ //if it's 0, transmit 0
                 Wire.beginTransmission(S2); // transmit to device 2
                Wire.write(0);              // sends 0
                Wire.endTransmission();    // stop transmitting
          
            }
            //---------------------------------------------------------------

            if(input.charAt(2) == '1'){ // okay here we check the character on 3 place, if it's 1, transmit 1
                Wire.beginTransmission(S3); // transmit to device 3
                Wire.write(1);              // sends 1
                Wire.endTransmission();    // stop transmitting
          
            }else if(input.charAt(2) == '0' ){ //if it's 0, transmit 0
                 Wire.beginTransmission(S3); // transmit to device 3
                Wire.write(0);              // sends 0
                Wire.endTransmission();    // stop transmitting
          
            }
            //---------------------------------------------------------------

              
              if(input.charAt(3) == '1'){ // The last arduino at the right side is the master, so here we directly turn the light off and on according to the input
                 digitalWrite(LEDP,HIGH);
              }else if(input.charAt(3) == '0' ){
                 digitalWrite(LEDP,LOW);
              }
              
       }
    
Okay now you will see the code for the slaves, again everything will be commented in the code below.
        #include <Wire.h>
            #define LEDP 13 // again define the LED on pin 13
            void setup() {
              // put your setup code here, to run once:
              Wire.begin(13);                /* join i2c bus with address 13, if you see to the code on the top, we have defined 3 divices
               with 11 as S1, 12 as S2 and 13 as S3. So you have to change this value according to the device */
              Wire.onReceive(receiveEvent); // register event
              pinMode(LEDP,OUTPUT); // set LED pin as an output
              Serial.begin(9600); //for debugging
              Serial.println("init");//for debugging
            }
            
            void loop() {
              delay(100);// we have to assign the delay, so that we can hear work with the input
            
            }
            void receiveEvent(int howMany) {
            
              
              if (Wire.available()) { // the same thing as in serial
                byte c = Wire.read(); // receive byte as a character
                Serial.println(c); // debug
                 if (c == 1){ // if the character equals to 1
                  digitalWrite(LEDP,HIGH); // turn on the led
                 }else if(c == 0){ // els if the character equals to 0 
                  digitalWrite(LEDP,LOW); // turn the led off
                 }
              }
            }
          
Works