title: 'IOError: [Errno 5] Input/output error' while using SMBus for analog reading through RPi
body: <p>I have been looking for the answer for the error mentioned in the title but for the first time i haavent got an answer yet. We ll im trying to make my Raspberry pi read analog data but when i run the code in terminal window it gives me 'IOError: [Errno 5] Input/output error'.</p>
  
  <p>The code im using to read analog data is shown below. Im using PCF8591 ADC converter. </p>
  
  <pre><code>from smbus import SMBus
  
  bus = SMBus(0)
  
  print "read a/d press ctrl + c to stop"
  
  bus.write_byte(0x48, 0)
  lastval = -1
  
  while True:
    reada = bus.read_byte(0x48)
    if(abs(lastval-reada) &gt; 2):
      print(reada)
      lastval=reada
  </code></pre>
  
  <p>I understand it might be because of the version changed in raspberry pi and i should change SMBus(0) to SMBus(1). For this i checked my RPi version which is not the revised one. But still I tried to run the program  by changing the SMBus number, still no luck with it.</p>
  
  <p>The error I get is shown below: </p>
  
  <pre><code>Traceback (most recent call last):
    File "analogread.py", line 7, in &lt;module&gt;
      bus.write_byte(0x48, 0)
  IOError: [Errno 5] Input/output error
  </code></pre>
  
  <p>Any help is appreciated. This is the basic block in my bigger project which im trying to execute. So, the fas thinster i get thing working the better i can build my application.
  Thank you</p>