I'm pulling my hair out over trying to get a VEML7700 I2C ambient light detector working.
Datasheet : https://www.vishay.com/docs/84286/veml7700.pdf
The device is correctly detected on the I2C bus at &H10 but I can only return zero values from registers &H04 and &H05 which should contain the ambient light values. I have tried various other configuration parameters in the control registers but still only zeroes returned.
With the control values in my code, a fresh reading should be returned after 900mS.
Is my code addressing the device in the right way or am I misunderstanding the IOBUFF usage?
(Running Annex32 WiFi 1.41 beta 5.)
Code: [Local Link Removed for Guests]
I2C.SETUP 13,15
' Reading ambient light level from VEML7700
IOBUFF.DIM(1, 2) ' Receive buffer
IOBUFF.DIM(0, 2) = &B00000010, &B00000000 ' Transmit buffer
I2C.WRITE_IOBUFF(0,2), &H10, &H00
IOBUFF.DIM(0, 2) = &B00000000, &B00000000
I2C.WRITE_IOBUFF(0,2), &H10, &H03
for x = 1 to 20
I2C.READ_IOBUFF(1), &H10, &H04, 2
LHi = IOBUFF.READ(1, 0)
LLo = IOBUFF.READ(1, 1)
wlog LHi, LLo
pause 100
next x