Skip to content

How to interact with Ks0251 keyestudio 4-channel Relay Shield

Notifications You must be signed in to change notification settings

codelyfe/4chan-relay-shield-arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

4chan-relay-shield-arduino

How to interact with Ks0251 keyestudio 4-channel Relay Shield

Links

https://wiki.keyestudio.com/Ks0251_keyestudio_4-channel_Relay_Shield

Sample Code

/*
  DANCE OFF

  This is a how to for the 
  Ks0251 keyestudio 4-channel Relay Shield

  I believe they did not have the right
  sample to teach others. So I made this one.
  
*/
  int PINDa = 4;
  int PINCb = 5;
  int PINBc = 6;
  int PINAd = 7;

void setup() {
  pinMode(PINDa, OUTPUT); // 4th Relay
  pinMode(PINCb, OUTPUT); // 3rd Relay
  pinMode(PINBc, OUTPUT); // 2nd Relay
  pinMode(PINAd, OUTPUT); // 1st Relay
}

void loop() {
  // 4th Relay
  digitalWrite(PINDa, HIGH); //   
  delay(100); //                       
  digitalWrite(PINDa, LOW); //    
  delay(100); // 
  // 3rd Relay  
  digitalWrite(PINCb, HIGH); //   
  delay(200); //                       
  digitalWrite(PINCb, LOW); //    
  delay(200); // 
  // 2nd Relay
  digitalWrite(PINBc, HIGH); //   
  delay(300); //                       
  digitalWrite(PINBc, LOW); //    
  delay(300); // 
  // 1st Relay
  digitalWrite(PINAd, HIGH); //   
  delay(100); //                       
  digitalWrite(PINAd, LOW); //    
  delay(100); //                     
}

About

How to interact with Ks0251 keyestudio 4-channel Relay Shield

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published