rvbockhooven / i2c7segment

Automatically exported from code.google.com/p/i2c7segment
0 stars 0 forks source link

IOError: [Errno 5] Input/output error on line 44 of i2c7segment.py #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Login to raspberry pi and open up python:

pi@raspberrypi ~/i2c7segment $ sudo python
Python 2.7.3rc2 (default, May  6 2012, 20:02:25) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import smbus

>>> from i2c7segment import *

>>> disp = Adafruit7Segment()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "i2c7segment.py", line 44, in __init__
    self.bus.write_byte(address, 0x21)
IOError: [Errno 5] Input/output error

I expected to get an instance of Adafruit7Segment() but instead I see the above 
error. I'm on a 512mb Model B and I'm using i2c7segment downloaded Tue Jan 15.

And I've hooked up my 7 segment display to 3V rather than 5V. Not sure if that 
matters. Otherwise, the pins are hooked up as suggested in the book.

Original issue reported on code.google.com by kitchene...@gmail.com on 16 Jan 2013 at 1:53

GoogleCodeExporter commented 8 years ago
Hmm... I think I probably don't have something hooked up properly. I can't 
detect 0x70 as an i2c address

pi@raspberrypi ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack $ 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: -- -- -- -- -- -- -- --  

Original comment by kitchene...@gmail.com on 16 Jan 2013 at 2:17

GoogleCodeExporter commented 8 years ago
yep, figured it out. I resoldered my pi cobbler and the issue went away.

Original comment by kitchene...@gmail.com on 16 Jan 2013 at 5:24

GoogleCodeExporter commented 8 years ago
I got the same error with dection 0x70 as an i2c address: 

pi@raspberrypi ~ $ sudo python 10_01_clock.py
Traceback (most recent call last):
  File "10_01_clock.py", line 4, in <module>
    disp = display.Adafruit7Segment()
  File "/usr/local/lib/python2.7/dist-packages/i2c7segment.py", line 44, in __init__
    self.bus.write_byte(address, 0x21)
IOError: [Errno 5] Input/output error
pi@raspberrypi ~ $ 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: 70 -- -- -- -- -- -- --                         

Please help me to figure out what is wrong.

Original comment by kwang...@gmail.com on 29 Sep 2013 at 4:05

GoogleCodeExporter commented 8 years ago
I'm getting the same issue as kitchenette@gmail.com got.

Do you recall what the problem was with your cobbler / soldering? 

Mine looks visually OK

Thanks

Ian

Original comment by ianw...@gmail.com on 1 Jan 2014 at 5:00

GoogleCodeExporter commented 8 years ago
Same error as Kwang @gmail.com have,

pi@raspberrypi ~ $ sudo python 10_01_clock.py
Traceback (most recent call last):
  File "10_01_clock.py", line 4, in <module>
    disp = display.Adafruit7Segment()
  File "/usr/local/lib/python2.7/dist-packages/i2c7segment.py", line 44, in __init__
    self.bus.write_byte(address, 0x21)
IOError: [Errno 5] Input/output error
pi@raspberrypi ~ $ 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: 70 -- -- -- -- -- -- -- 

Does anyone figure it out why? and solution is?

Thanks in advance,

Original comment by takeon...@gmail.com on 25 Feb 2014 at 3:40

GoogleCodeExporter commented 8 years ago
I finally figured it out!

On line 42 of i2c7segment.py, it's hardcoded to use smbus.SMBus(0). However, 
sometimes you need to use smbus.SMBus(1).

Run the following to figure out if you should use 0 or 1.

sudo i2cdetect -y 0
sudo i2cdetect -y 1

You should see "70" in one of these two.

If you're just trying to get it to work, edit i2c7segment.py to change the bus 
to whatever you want, and re-install the library if desired.

To fix this properly, perhaps you should:

 * Let the user pass a bus number.
 * If the user doesn't pass a bus number, try both buses (catch the IOError when you try one in order to try the other).

Original comment by jji...@gmail.com on 11 May 2014 at 2:07