I have a Onion Omega2+ plugged into a CE PR32-3 (adapter), thence into a MCP23008 / PEIO4R4G5LE (4-relay "shield" with I2C interface).
Using a simple Python script, I was controlling the relays quickly. So far, so good.
I plugged a SI7020-A20 (temperature / humidity sensor) into the I2C bus. The LED lights up.
This device has no addressable registers, so has a different programming interface than what the onionI2C Python library provides. There is i2c.readBytes(), but no i2c.read(). I suspect this is the root of my problem, but I tried this Python script:
#!/usr/bin/env python
from OmegaExpansion import onionI2C
import time
i2c = onionI2C.OnionI2C()
i2c.write(0x40, [0xF5]) # 0x40 is the I2C address, 0xF5 is the command to start a conversion
time.sleep(0.5)
data = i2c .readBytes(0x40, 0x00, 2) # This device has no addressable registers, so this readBytes() call is suspect, but there is no i2c .read()
print "%x" %data[0]
print "%x" %data[1]
I get:
0
3f
Specced conversion gives RH of -5.88%. I've never heard of negative humidity!
I'm sure it's something really silly, but I have fiddled around a lot with the write(), writeBytes(), and readBytes() calls and not gotten anywhere.
It could be that I need to abandon Python and try to use more primitive functions that might be available in the C libraries, but I was sorta trying to avoid that. I haven't gotten anywhere with the cloud C compiler at all! All I get is an inert Web page that doesn't do anything.