[MUSIC] This lecture, we'll talk about, again, the general purpose IO pins on the Raspberry Pi. And we'll talk specifically about the pins that are multi-function pins that have a function that's dedicated to communication protocols with other devices or other chips, or things like that. So a couple of these pins are for I2C communication protocol. Now if you remember I2C, it's a serial communication protocol between, generally used between two chips or two devices that are relatively close, that can share a clock. So, this is a clocked, a synchronous protocol, so the two devices have to be close enough that they can share the same clock. So, typically, on the same board or something like that. They've gotta be physically close. So, I2C protocol, it's got two wires, its SDA and SCL. SDA sends the sends the data as with data gets sent and received, and SCL is where the clock that gets sent. Now this is as oppose to the UART, which we were just talking about. UART done in the last lecture. UART is not clocked. There's no clock in there, so they don't have a clock wire or clock pin. I2C does have a clock pin, which makes it a lot faster protocol, but it is restricted in distance because you have to be close enough that you can send a clock with MSQ. Okay, so, pin 3 is the SDA line, pin 5 is the SDL line. So, they can be used for I2C communications. The idea is that if you had several different, say Raspberry Pis, or other devised that had I2C, you connect all their SDA lines together, and connect all their SCL lines together, and they can communicate using I2C protocol. Now of course you'd have to write the appropriate code, we'll talk about that later, but you'd write some Python code that can read I2C data, write I2C data, things like that, but it would do it through these two pins. Another communication protocol, very common, just like I2C, is SPI, Serial Parallel Interface. We talked about this, actually, in the context of the Arduino. And actually, Arduino uses this heavily for communicating between the board and the shields when you stack them. But this protocol basically involves four wires, at least four. First you got the MOSI. So if you look at pin 19 that says SPI 0MOSI. That's master out, slave in. Then pin 21, that's MISO, master in, slave out. So, each one of those wires is directional, right, so master out. So say this device is a master, then the MOSI is the output, and MISO the input. And then S clock S pin 23, SCLK, that's the clock that all the devices would share. So, in addition to that though, there's also a chip enable. Now chip enable is because with SPI, if you remember, there can be a master, the single master, talking to many slaves. But it can only talk to one slave at a time. So it needs to assert the chip enable for the particular slave that it's talking to, to let that slave know it is communicating, right, that slave should wake up and listen. So each slave has to have a chip enable associated with it that the master can assert, can pull down, in order to wake them up and have them listen. So in this case, in this board you get two chip enables, pins 24 and 26. So 24 is chip enable CE0, and 26 is CE1. And notice the N after the name, CE0_N, CE1_N. N is for negative. So it's negatively assertive, meaning you have to pull that wire down so the Raspberry Pi will send that from one to zero to let the client know, let the slave know that it is being communicated with. So Raspberry Pi gives you two chip enabled pins. You might need more, depending on how many SPI components are on your bus, how many slaves you have on your bus, cuz you need a chip enabled for every single slave. But this gives you two, which is pretty good. I mean, I don't know how many you are gonna need, depends on the application. So this is SPI, and SPI you've got the MOSI and MISO, and you got two chip enables. And again, when you actually do this, when you actually use this protocol, you'll be using the Python library for communication, which we will talk about later. Thank you. [MUSIC]