Ks0251 keyestudio 4-channel Relay Shield

From Keyestudio Wiki
Jump to navigation Jump to search

keyestudio 4-channel Relay Shield


thumb

Introduction

Keyestudio 4-channel relay shield will integrate 4-channel 5V relay module, which is fully compatible with keyestudio UNO R3 control board. It can work through stacking shield on the keyestudio UNO R3 control board, which is very easy and convenient. The 4-channel relay of shield is for high level effectively. And 4-channel relay control port should respectively connect with the digital port 4, 5, 6, 7 which is on the keyestudio UNO R3 control board. We only need to control the high and low level outputs of digital port 4, 5, 6, 7 on the 4-channel relay, which can achieve to control the relay switch.

Specification

·Working style: high level is effective

·Contact capacity: AC120V / 3A ; DC24V/3A

Code


int BASE = 4 ;  //The first relay is connected to the I / O port
int NUM = 4;   //Total number of relays
void setup()
{
   for (int i = BASE; i < BASE + NUM; i ++) 
   {
     pinMode(i, OUTPUT);   //Set the number I/O port to outputs
   }
}
void loop()
{
   for (int i = BASE; i < BASE + NUM; i ++) 
   {
     digitalWrite(i, LOW);    //Set the number I/O port outputs to "low", that is, gradually turn off the relay.
     delay(200);        //delay 0.2S
   }
   for (int i = BASE; i < BASE + NUM; i ++) 
   {
     digitalWrite(i, HIGH);    //Set the number I/O port outputs to "high", that is, gradually open relay.
     delay(200);        //delay 0.2S
   }  
}

Get One Now

http://www.keyestudio.com/keyestudio-4-channel-relay-shield.html