Download Print this page

With Arduino; With Raspberry Pi - SeeedStudio Grove-Relay User Manual

Advertisement

3.2

With Arduino

Below is a demo that shows you how to control a Grove - Relay with a Grove - Button. When the
button gets pressed, the relay will close.
// Project Five - Relay Control
//
void setup()
{
pinMode(1, INPUT);
pinMode(2, INPUT);
pinMode(6, OUTPUT);
}
void loop()
{
if (digitalRead(1)==HIGH)
{
digitalWrite(6, HIGH);
delay(100);
}
if (digitalRead(2)==HIGH)
{
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.
5

Advertisement

loading
Need help?

Need help?

Do you have a question about the Grove-Relay and is the answer not in the manual?