CHAPTER 13I2C Bus Communication
The I2C bus is a powerful feature of the NXT because it provides the NXT with practically unlimited expansion capability. Although it's located on the input port connector, it's actually used for expanding both inputs and outputs. Only two wires are necessary because the data is transmitted serially, or one bit at a time. One wire is sending and receiving data (SDA), and the other is providing a clock (SCL). On the input port connector, SDA is pin 6 and SCL is pin 5, or blue and yellow in the NXT cable. You need a third wire for ground, which is either pin 2 or 3, black or red in the NXT cable.
Note The original NXT firmware had some problems with I2C communications, so make sure you're running at least version ...
Get Extreme NXT: Extending the LEGO MINDSTORMS NXT to the Next Level now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.