robotpy / examples

Repository of RobotPy example projects
43 stars 52 forks source link

Add i2c-communication example #90

Closed fletch3555 closed 9 months ago

fletch3555 commented 9 months ago

There very well may be a better way to do this. I'm more of a java dev than a python dev, so please feel free to tear this apart.

Specifically, Java requires a few calls to convert the String to a char[] then to a byte[]. Here, I've simply converted the string to a bytearray.

I'm also using I2C.writeBulk() instead of I2C.transaction() per the docstring on the transaction method. I can switch it back if you prefer.