Hardware Reference
In-Depth Information
This line reads a byte from the device. The default is to read from address 0 of the
selected device. Address 0 for the TMP102 is the current temperature. As soon as
the register is read, the onReadByte() function is called.
The value, x , passed to onReadByte() is an object. The .event field of the ob-
ject informs us if we have a callback.
If this is a callback, use console.log to display the contents of object x .
Finally, print the result field, x.res , after converting it to degrees F.
Run the code by using the following command:
bone# ./i2cTemp.js
onReadByte: {"err":null,"res":24,"event":"callback"}
75.2F
 
 
 
Search WWH ::




Custom Search