I2CRECEIVE
Action
Receives data from an I2C serial device.

Syntax
I2CRECEIVE slave, var
I2CRECEIVE slave, var ,b2W, b2R

Remarks

slave A byte, Word/Integer variable or constant with the slave address from the I2C-device.
Var A byte or integer/word variable that will receive the information from the I2C-device.
b2W The number of bytes to write.
Be cautious not to specify too many bytes!
b2R The number of bytes to receive.
Be cautious not to specify too many bytes!
In BASCOM LT you could specify DATA for var, but since arrays are supported now you can specify and array instead of DATA.

This command works only with some additional hardware. See appendix D.

See also
I2CSEND

Example
x = 0 'reset variable
slave = &H40 'slave address of a PCF 8574 I/O IC
I2CRECEIVE slave, x 'get the value
PRINT x 'print it


Dim buf(10) as String
buf(1) = 1 : buf(2) = 2

I2CRECEIVE slave, buf(), 2, 1 'send two bytes and receive one byte
Print buf(1) 'print the received byte