Wrote new I2C topic.
This commit is contained in:
parent
6d726b7499
commit
8b9c3d71d5
32
docs/reference/pins/i2c-read-number.md
Normal file
32
docs/reference/pins/i2c-read-number.md
Normal file
@ -0,0 +1,32 @@
|
||||
# I2C Read Number
|
||||
|
||||
Read one number from the specified 7-bit I2C address, in the specified
|
||||
number format.
|
||||
|
||||
```sig
|
||||
pins.i2cReadNumber(0, NumberFormat.Int8LE);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* ``address``: the 7-bit I2C address from which to read the number.
|
||||
* ``format``: the number format. Formats include
|
||||
**Int8LE**, **UInt8LE**, **Int16LE**, **UInt16LE**, **Int32LE**,
|
||||
**Int8BE**, **UInt8BE**, **Int16BE**, **UInt16BE**, and
|
||||
**Int32BE**.
|
||||
* **Int** stands for "integer", and **UInt** stands for "unsigned integer".
|
||||
* **LE** stands for "little-endian" and **BE** stands for "big-endian".
|
||||
* The number in each format name stands for the number of bits in the format.
|
||||
|
||||
### Example
|
||||
|
||||
The following example reads a number in big-endian, 16-bit, unsigned integer
|
||||
format from the 7-bit I2C address `32`.
|
||||
|
||||
```blocks
|
||||
pins.i2cReadNumber(32, NumberFormat.UInt16BE);
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
[I2C](https://en.wikipedia.org/wiki/I%C2%B2C)
|
Loading…
Reference in New Issue
Block a user