Support » Pololu Isolated USB-to-I²C Adapter User’s Guide »
5. Writing PC software to control the adapter
To successfully use the adapter, you will likely have to write some software that runs on your computer, connects to the adapter’s serial port, sends commands to it, and interprets the responses from the adapter. We provide a Pololu Isolated USB-to-I²C Adapter library for Python that can do all of that.
Here is some example code that uses the Python library to read the “Model ID” and “Model Type” registers from a VL53L1X time-of-flight distance sensor:
#!/usr/bin/env python3 import pololu_usb_i2c_adapter i2c = pololu_usb_i2c_adapter.Adapter('/dev/ttyACM0') address = 0b0101001 i2c.write_to(address, b'\x01\x0F') data = i2c.read_from(address, 2) print(data)
Alternatively, you can use the Pololu Isolated USB-to-I²C Adapter from any programming environment that allows writing and reading binary data from a serial port. Basic applications only need to implement two simple serial commands: I²C Read and I²C Write. Those two commands are documented at the top of Section 7.