Outputs that require multiple pins

There are many types of output, many of which only need one output pin for data, such as LEDs and the Piezo element that we used in the last few chapters. However, there are nearly an infinite number of output devices that we can use—many of them require more complicated instructions than one output pin is capable of sending.

These devices work in several different ways, and while the exact ways are well beyond the scope of this book, we'll go over a few very common types. For this chapter, however, we'll just go over the I2C, because it is the common format for the device that we will use in this chapter's project.

Inter-Integrated Circuits (I2C)

I2C, or Inter-Integrated Circuits, are output devices that can share the same set of two data pins. The data pins are usually called SCL (Serial Clock Line) and SDA (Serial Data Line), where SCL handles timing and SDA sends data. The reason you can wire many devices to one pair of digital output pins is because in order to send or receive a message from an I2C device, you need to know its address—a hexadecimal byte prefaced to every message to the device that determines which device the message is meant for.

I2C is also commonly used for input devices that have a lot of data to send, such as some accelerometers and magnetometers, as we'll see in the next chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset