Python grove_sound_sensor.py

HI

im trying to build a fairly simple sound sensor but am unable to get it working with the GrovePi+ & Pi3b+

Getting this error every time
Traceback (most recent call last):
  File "niall", line 21, in <module>
    sensor_value = grovepi.analogRead(sound_sensor)
  File "build/bdist.linux-armv7l/egg/grovepi.py", line 227, in analogRead
TypeError: 'int' object has no attribute '__getitem__'

Any help out there maybe

Thanks

Hi @nialloneill32,

There can be 3 possible problems:

  1. The I2C is not enabled.

  2. The firmware is not flashed to the GrovePi. Follow this.

  3. The firmware is already flashed and it’s version v1.2.7 which already has some bugs in it, in which case, I’d recommend you go with the v1.3.0 beta version. You can find out more details here.

Thank you!

Hi Robert
Thank you so much for your response, I will try your solution when I get home this evening.

Regards

Niall

HI Robert

I tried your solutions above but with little success.

I am a first year studying computer science and am doing an IOT project. Getting a reading from the sound detector is crucial to the project.

Attached is my log file. If you have time , can you take a quick look at it, Id really appreciate any help you can give on it.

Many thanks

log.txt (5.22 KB)

Hi Robert

Just some more round my issue. I found a thread of what i thing is a similar issue

https://forum.dexterindustries.com/t/solved-grove-pi-int-object-has-no-attribute-error-when-analogread/3739/2

Although your suggestion resolved the users issue, I get the following error when I try to follow your suggestion

Do you want to update the firmware? [y,n]y

Make sure that GrovePi is connected to Raspberry Pi

Firmware found

Press any key to start firmware update

. . .

/home/pi/Desktop/GrovePi/Firmware/grovepi_firmware_update.sh: line 3: avrdude: command not found

/home/pi/Desktop/GrovePi/Firmware/grovepi_firmware_update.sh: line 4: avrdude: command not found

/home/pi/Desktop/GrovePi/Firmware/grovepi_firmware_update.sh: line 5: avrdude: command not found

/home/pi/Desktop/GrovePi/Firmware/grovepi_firmware_update.sh: line 6: avrdude: command not found

Any thoughts

Did you ever figure this out? im having the exact same issue