All Analog-Sensors gets Error 5 in python

Hi there,

When I connect a analog-sensor like air-quality-sensor or light-sensor I become an input/output Error 5 in python shell. All other sensors which are digital or i2c sensors works perfectly. Only the analog-sensors are not working. Can you help me?

sorry for my english :slight_smile:

It’s fine :slight_smile: Could you provide the code you were using?
Plus welcome to the forums :smile:

thank you :blush:
I have used the example from dexter:import time
import grovepi

Connect the Grove Air Quality Sensor to analog port A0


air_sensor = 0


while True:
# Get sensor value
sensor_value = grovepi.analogRead(air_sensor)

    if sensor_value > 700:
        print "High pollution"
    elif sensor_value > 300:
        print "Low pollution"
        print "Air fresh"

    print "sensor_value =", sensor_value

except IOError:
    print "Error"

Sorry, forgot to ask what error messages do you get or outputs if any?
I was also unable to access the page, I’ll report the page is down. Until then I’ll do my best I can to figure this out.

Hi @leon.luethi,

As @graykevinb said, can you post a screenshot of the error message that you get and also follow this guide, generate a test log and post it along with your reply. If possible can you post a few pictures of your setup when you get this error to help you better.


1 Like

Thanks @Shoban. I’d like to add that the wiki has been undergoing changes and @cleoqc showed me the new link:

More about that on the thread:

thank you for your help @graykevinb @Shoban! :slight_smile:
Today I startet my raspberry with the connected air_quality_sensor an re-run the script. I don’t know but now it works… I can not reproduce the fail. So strange!

Well glad it’s working! :slight_smile:
Yah, These bugs can be odd at times.
Maybe you had it plugged in wrong and it got wiggled when you tried again or something. Anyways glad it works. emphasized text Have fun with it!