I have an Adafruit RPI3 running Raspbian version = "8 jessie". I connected a CO2 sensor via I2c and the sensor properly responds to
i2cdetect -y 1 with 0x68 and 0x69. I believe these are read and write addresses.
Here is my code that compiles with no errors with the Raspian Geany programming editor:
import smbus DEVICE_BUS = 1 DEVICE_ADDR = 0X69 bus = smbus.SMBus(DEVICE_BUS) bus.write_byte_data(DEVICE_ADDR, 0X00,0X01) print("Wrote to bus")
When from Geany I execute, a Terminal opens with the following message:
Traceback (most recent call last): File "smb_bus_write.py", line 9, in <module> bus.write_byte_data(DEVICE_ADDR, 0X00,0X01) IOError: [Errno 5] Input/output error