That Was QuickΒΆ
Published on 2017-05-28 in D1 Mini Analog Shield.
At last a project that went smoothly for a change. The MAX1238 chips arrived, and I soldered them to the PCBs and they seem to be working just fine at first sight. I was a bit worried about the chips being too small when I saw them, but they are fine.
I wrote a very simple MicroPython library to handle this shield:
class MAX123x:
def __init__(self, i2c, address=0x35):
self.i2c = i2c
self.address = address
self.reset()
def reset(self):
self.i2c.writeto(self.address, b'\x80')
def read(self, channel):
if not 0 <= channel <= 11:
raise ValueError()
data = self.i2c.readfrom_mem(self.address, 0x61 | (channel << 1), 2)
return ((data[0] & 0x0f) << 8) | data[1]