Hardware Reference
In-Depth Information
Figure 2-19. Table of I 2 C outputs
Once the I 2 C device is wired up, you can use a couple handy I 2 C tools to test the device.
Because these are Linux command-line tools, you have to use 1 as the bus number.
i2cdetect , shown in Example 2-11 , shows which I 2 C devices are on the bus. The -r
flag indicates which bus to use. Our TMP102 is appearing at address 0x49 . You can use
the i2cget command to read the value. It returns the temperature in hexidecimal and de-
grees C. In this example, 0x18 = 24°C, which is 75.2°F. (Hmmm, the office is a bit warm
today.) Try warming up the TMP102 with your finger and running i2cget again.
Example 2-11. I 2 C tools
bone# i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
Search WWH ::




Custom Search