jaques / sht21_python

Python library for reading data over i2c (tested on raspberry pi)
MIT License
34 stars 19 forks source link

IOError: [Errno 5] Input/output error #2

Open Neocramencer opened 10 years ago

Neocramencer commented 10 years ago

Hey,

i want to use your python Version in a script. Currently iam using the C Version of emsystech and this is running fine. So i just used your python script but this is giving me the IO Error: IOError: [Errno 5] Input/output error, even if i run it with sudo.

I also changed the I2C Device Number to 1 because iam using an actual raspberry Version. What can i do?

Thanks Marc

jaques commented 10 years ago

Hi Marc,

I've only got a revision 1 Raspberry Pi, so I use I2C device 0. As I understand it, if you have a newer revision 2 Raspberry Pi you need to use I2C device 1.

I get the same error as you when I tried changing mine to device 1. It might be worth double checking with i2cdetect (this must be run as root as well) that device 1 is correct.

On my machine, there's nothing on device 1.

pi@raspberrypi ~/sht21/sht21_python $ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

but you can see sht21 on device 0.

pi@raspberrypi ~/sht21/sht21_python $ sudo i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- 77

Richard.

Neocramencer commented 10 years ago

Hi Richard,

i already checked that and changed your scriptlone to i2C device 1. The C code from emsystech is running fine so I2C is good. But your python script gave me the IO error.

Best regards Marc

poohsen commented 9 years ago

same issue here with a 512 MB raspi. emsystech code runs fine but the python code gives me "errno 5"