
8
5.2
With Raspberry Pi
1. You should have got a raspberry pi and a grovepi or .
2. You should have completed configuring the development enviroment, otherwise follow
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_electricity_sensor.py # "Ctrl+x" to exit #
import time
import grovepi
# Connect the Grove Electricity Sensor to analog port A0
# SIG,NC,NC,GND
sensor = 0
grovepi.pinMode(sensor,"INPUT")
# Vcc of the grove interface is normally 5v
grove_vcc = 5
while True:
try:
# Get sensor value
sensor_value = grovepi.analogRead(sensor)