Datasheet

6
Now, feel the vibration of your motor!
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 D8 by using a grove cable.
4. Navigate to the demos' directory:
cd yourpath/GrovePi/Software/Python/
To see the code
nano grove_vibration_motor.py # "Ctrl+x" to exit #
import time
import grovepi
# Connect the Grove Vibration Motor to digital port D8
# SIG,NC,VCC,GND
vibration_motor = 8
grovepi.pinMode(vibration_motor,"OUTPUT")
while True:
try:
# Start vibrating for 1 second
grovepi.digitalWrite(vibration_motor,1)
print 'start'
time.sleep(1)
# Stop vibrating for 1 second, then repeat
grovepi.digitalWrite(vibration_motor,0)
print 'stop'
time.sleep(1)
except KeyboardInterrupt:
grovepi.digitalWrite(vibration_motor,0)
break
except IOError:
print "Error"