Grove hat with raspberry pi 4

Hello,

I have a raspberry pi 4 with a raspberry pi 7 inch screen and a grove hat, linked to a adxl1001 sensor.
My problem is that I can’t get it to read from the analog ports. It gives me a Typeerror: Int not subscriptable on the analogRead part of the grovepi module.

I’ve tried changing os and even installing raspbian for robots experimental version for raspberry pi 4, which doesn’t work. How can I get this to work?

The way I installed the grove on the raspberry pi was with the manual instalation of grove.py, because the os is >bullseye. Then I installed the grovepi module with pip, the only way it worked.

What am I doing wrong?

TypeError: Int not subscriptable error typically occurs when you try to access an index of a variable that is not a sequence type (like a list or tuple). It seems like there might be an issue with how the analog read function is being called.

The code I use is as follows:
import grovepi
grovepi.pinMode(0,‘INPUT’)
grovepi.analogRead(0)

The grove hat has the sensor on analog port 0. The error happens in the analogRead function of grovepi module.

Try to update the GrovePi library installed on your computer. If not run this command

pip install --upgrade grovepi