DexterInd / GrovePi

GrovePi is an open source platform for connecting Grove Sensors to the Raspberry Pi.
https://www.dexterindustries.com/grovepi/
Other
490 stars 487 forks source link

Getting 'TypeError: 'int' object has no attribute '__getitem__' testing airquality sensor (python) #390

Open fernandoagarcia opened 6 years ago

fernandoagarcia commented 6 years ago

Just got my new GrovePi+ board and I when through the install process using the 'Quick Start' method:

sudo curl -kL dexterindustries.com/update_grovepi | bash

tested the board using:

sudo i2cdetect -y 1

and got the OK with the following result and installed the sensor on the A0 interface:

0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- 04 -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

The issue is when running the example test script for the air sensor I have I get a TypeError:

Traceback (most recent call last): File "grove_air_quality_sensor.py", line 46, in <module> sensor_value = grovepi.analogRead(air_sensor) File "/home/pi/Dexter/GrovePi/Software/Python/grovepi.py", line 227, in analogRead return number[1] * 256 + number[2] TypeError: 'int' object has no attribute '__getitem__'

Everything lights up fine the board is fine. I think the issue is the script itself or maybe a version issue. Any help would be great. TY

fernandoagarcia commented 6 years ago

Solved this but following the instructions here: https://www.google.com/search?q=error+%2FPython%2Fgrovepi.py%22%2C+line+227%2C+in+analogRead&oq=error+%2FPython%2Fgrovepi.py%22%2C+line+227%2C+in+analogRead&aqs=chrome..69i57.2054j0j4&sourceid=chrome&ie=UTF-8