Grovepi collision sensor not working

Hi All,

I have raspberry 3B, GrovePI and I am using Raspbian. I attached the collision sensor on D2 and I run the following piece of code:

import time
import grovepi

Connect the Grove Collision Sensor to digital port D2

SIG,NC,VCC,GND

collision_sensor = 2

grovepi.pinMode(collision_sensor,“INPUT”)

while True:
try:
print(grovepi.digitalRead(collision_sensor))
time.sleep(.5)

except IOError:
    print ("Error")

When I execute, the value is always 1. There is any dependency on a vibration or collision. Rarely I have 0

Maybe I need to change the calibration. Is there a way to do?

Can you help me?

Is this D2 useful in your other code? Is there any footprint on the hardware?

yes, I tried with a Led. What is a footprint?

Alessandro

I mean is this pin used in any of your other code?