EasyManuals Logo

SeeedStudio Grove Series User Manual

Default Icon
51 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #24 background imageLoading...
Page #24 background image
Example - 03 : Controlling other electronics (Relay)
WHAT ARE WE DOING HERE?
This example showcases how to use the Grove-relay module to control a larger load, i.e. a desk
lamp light. A 3V voltage signal can cause the relay to switch on, allowing current to flow through
the connected appliance.
WARNING special care should be taken when using the Relay.
THE CIRCUIT
Parts:
Grove-Relay x1
Grove cable x1
Grove-Base BoosterPack x1
LaunchPad Development Kit
Connections:
Plug the relay module into Grove connector
J14 on the BoosterPack. This will link the SIG
pin of the relay to pin 39 of the LaunchPad.
CODE
This is essentially the same as the blink LED code from Example #1. In this case, we are simply
opening & closing the relay switch once per second.
This example is available here: File > Sketchbook > LaunchPad_Kit > Grove_Modules > relay
/*
Relay
The basic Energia example.
This example code is in the public domain.
*/
#define RELAY_PIN 39
// the setup routine runs once when you press reset:
void setup() {
pinMode(RELAY_PIN, OUTPUT); // initialize the digital pin as an output.
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(RELAY_PIN, HIGH); // turn the relay on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(RELAY_PIN, LOW); // turn the relay o by making the voltage LOW
delay(1000); // wait for a second
批注 [10]: update to proper file location
批注 [11]: update to latest code

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the SeeedStudio Grove Series and is the answer not in the manual?

SeeedStudio Grove Series Specifications

General IconGeneral
BrandSeeedStudio
ModelGrove Series
CategoryMicrocontrollers
LanguageEnglish

Related product manuals