باللغة العربية

 

English Video:

To control three LEDs (ON/OFF) using the I2C communication protocol between a master Arduino Uno and a slave Arduino Uno, you can follow these steps:

Hardware Setup:

  1. Master Arduino Uno Setup:
    • Connect three LEDs with current-limiting resistors (usually 220-330 ohms) to digital pins of the master Arduino (e.g., pins 2, 3, and 4).
    • Connect SDA (analog pin 4) and SCL (analog pin 5) to the corresponding pins on the slave Arduino.
  2. Slave Arduino Uno Setup:
    • Connect three LEDs with current-limiting resistors (one for each LED) to digital pins (e.g., pins 8, 9, and 10).
    • Connect SDA (analog pin 4) and SCL (analog pin 5) to the corresponding pins on the master Arduino.

       

      // ██████╗ ███████╗██╗███████╗███████╗    ██████╗ ██████╗ ███╗   ███╗
      //██╔═████╗██╔════╝██║██╔════╝██╔════╝   ██╔════╝██╔═══██╗████╗ ████║
      //██║██╔██║███████╗██║█████╗  █████╗     ██║     ██║   ██║██╔████╔██║
      //████╔╝██║╚════██║██║██╔══╝  ██╔══╝     ██║     ██║   ██║██║╚██╔╝██║
      //╚██████╔╝███████║██║███████╗██║  ██╗   ╚██████╗╚██████╔╝██║ ╚═╝ ██║
      // ╚═════╝ ╚══════╝╚═╝╚══════╝╚═╝  ╚═╝   ╚═════╝ ╚═════╝ ╚═╝      ╚═╝
      

       

      Explanation:

      • The master Arduino sends commands to the slave Arduino using the I2C communication protocol. It sends the LED pin number (2, 3, or 4) to the slave Arduino, which will toggle the corresponding LED on or off.
      • The slave Arduino listens for I2C messages and reacts to them by toggling the LEDs according to the received pin number.
      • Make sure to upload the master code to one Arduino and the slave code to the other Arduino.
      • Connect the Arduinos and LEDs as described in the hardware setup section.
      • When you run this setup, the LEDs on the slave Arduino will turn on and off sequentially in response to the commands sent by the master Arduino.

      This code demonstrates how to control LEDs between two Arduinos using the I2C protocol. You can expand upon this example to control more devices or add additional features as needed.

       

      // ██████  ███████ ██ ███████ ███████     ██████  ██████  ███    ███ 
      //██  ████ ██      ██ ██      ██         ██      ██    ██ ████  ████ 
      //██ ██ ██ ███████ ██ █████   █████      ██      ██    ██ ██ ████ ██ 
      //████  ██      ██ ██ ██      ██         ██      ██    ██ ██  ██  ██ 
      // ██████  ███████ ██ ███████ ██      ██  ██████  ██████  ██      ██ 
      

       

      osief.com
       osief.com
        osief.com
         osief.com
          osief.com
           osief.com
            osief.com

             osief.com
              osief.com
               osief.com
                osief.com
                 osief.com
                  osief.com
                   osief.com

                    osief.com
                     osief.com
                      osief.com
                       osief.com
                        osief.com

                         osief.com
                          osief.com
                           osief.com
                            osief.com
                             osief.com
                              osief.com
       

       

      0sief