--Main: Raspberry Pi 3 Model B + --Language: Python --Sensor: SHT31-D
I referred to this page this time.
Get the temperature and humidity from the sensor using Raspberry Pi!
It was very easy to understand, but when I wrote the code as it was, I got an error.
Traceback (most recent call last):
File "SHT31D.py", line 16, in <module>
i2c.write_byte_data(i2c_addr, 0x21, 0x30)
OSError: [Errno 121] Remote I/O error
When I looked it up, it seems that I2C cannot be used because the slave address is incorrect.
$ sudo i2cdetect -y 1
I typed this in the terminal
I'm not sure how to read the table now, It turns out that it seems to be the address 44 on the device connected by I2C. 14th line
i2c_addr = 0x45
From
i2c_addr = 0x44
It worked when I changed it to. ... error, not line 16 ...
After that, although there were spelling mistakes, I corrected it and it worked.
I wasn't sure why the addresses were different, so The future issue is clear.