Wire.begin() - This function initiates the Wire library and joins the bus as a master or slave.Let’s go through a few of the functions that we’ve used from the Wire library: The following image shows the I2C pins in the Arduino UNO. It is mainly used to communicate with a sensor or other devices that need to send information to a master device and comes in handy when a microcontroller has to communicate with other slave modules using a minimum set of wires. I2C communication is used only for short-distance communication. Note: At any given time only the master will be able to initiate the communication. Serial Data (SDA): Sends the data to and fro between the master and slave. Serial Clock (SCL): Shares the clock signal generated by the master with the slave The communication takes place through two wires namely Serial Clock (SCL) and Serial Data (SDA). One of the advantages of I2C communication is that it allows more than one slave to be connected to the Master. Communication always occurs between a Master and a Slave. As mentioned earlier, it uses two wires which are connected across both the devices, wherein one device is called the master and the other device is called a slave. I2C communication protocol was first introduced by Philips. It consists of only two wires to share information, out of which one is used for the clock signal and the other one is used for sending and receiving data. I2C is a synchronous communication protocol, unlike the UART synchronous implies that both the devices that are sharing the information share a common clock signal. It’s normally denoted as I2C or I squared C or even as 2-wire protocol (TWI) in some instances - all indicative of the same. The term I2C stands for ‘Inter-Integrated Circuits’.
0 Comments
Leave a Reply. |