Datasheet
6
digitalWrite(6, LOW);
}
}
3.3 With Raspberry Pi
This sample is show you how to use Grove - Relay by Raspberry Pi . The demo below will show that the relay be control by
Grove -Button.
# Raspberry Pi + Grove Switch + Grove Relay
import time
import grovepi
# Connect the Grove Switch to digital port D3
# SIG,NC,VCC,GND
switch = 3
# Connect the Grove Relay to digital port D4
# SIG,NC,VCC,GND
relay = 4
grovepi.pinMode(switch,"INPUT")
grovepi.pinMode(relay,"OUTPUT")
while True:
try:
if grovepi.digitalRead(switch):
grovepi.digitalWrite(relay,1)
else: