実際のところ
from machine import Pin, I2C import utime slaveAddress = 0x42 registerAddress = 0x06 writeData = b'123' i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=100000) #接続先を調べる i2c.scan() #slaveAddressに対し書き込み i2c.writeto(slaveAddress, writeData) utime.sleep(1) #slaveAddressから4バイト分読み出す i2c.readfrom(slaveAddress, 4) #slaveAddressのregisterAddressから4バイト読み出す i2c.readfrom_mem(slaveAddress, registerAddress, 4) utime.sleep(1)