Hello guys, today we would like you to meet our new Surilli.io member, the "Surilli Relay Shield." This add-on is stackable onto any Surilli development board as shown in the picture below. We will be using one of the two relays on the Surilli Relay Shield to switch two pins on the Surilli Basic M0, HIGH and LOW. Let's not wait and get started!
Note: If you are using this Surilli for the first time, follow our Startup Guide for Surilli Basic M0 and then move to step 1.
STEP 1: Set Up Arduino IDE for SurilliMake sure you have selected the right port, board and processor for the Surilli as shown in the picture below and it is programmable (compile and upload “Blink” from File>Examples>Digital>Blink onto your Surilli to check if everything is working fine).
The circuitry is very simple. Complete your circuit connections as shown in the figure below and then move onto the next step. Do not forget to stack the relay shield onto Surilli. Stacking powers up the relay board.
- Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE. Hit the upload button.
- After it is uploaded successfully, move to the next step. Your Surilli is now ready to turn ON and OFF your appliance.
Arduino Code:
int FirstRelayPin = 5;
int SecondRelayPin = 6;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital Relay_Pins as an output.
pinMode(FirstRelayPin, OUTPUT);
pinMode(SecondRelayPin, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(FirstRelayPin, HIGH); // turn the Relay on (HIGH is the voltage level)
digitalWrite(SecondRelayPin, HIGH);
delay(1000); // wait for a second
digitalWrite(FirstRelayPin, LOW); // turn the Relay off by making the voltage LOW
digitalWrite(SecondRelayPin, LOW);
delay(1000); // wait for a second
}
That’s all for now. If you have any queries, visit surilli.io or contact our support. Stay connected with Surilli family for more amazing stuff. :-)
Comments
Please log in or sign up to comment.