Datasheet
7
else
{
digitalWrite(ledPin,LOW);
}
}
4.2 With Raspberry Pi
1. You should have got a raspberry pi and a grovepi or grovepi+.
2. You should have completed configuring the development enviroment, otherwise follow here.
3. Connection
Plug the sensor to grovepi socket A0 by using a grove cable.
4. Navigate to the demos' directory:
cd yourpath/GrovePi/Software/Python/
To see the code
nano grove_piezo_vibration_sensor.py # "Ctrl+x" to exit #
import time
import grovepi
# Connect the Grove Piezo Vibration Sensor to analog port A0
# OUT,NC,VCC,GND
piezo = 0
grovepi.pinMode(piezo,"INPUT")
while True:
try:
# When vibration is detected, the sensor outputs a logic high
signal
print grovepi.analogRead(piezo)
time.sleep(.5)
except IOError:
print "Error" print "Error"










