Skip to content

Instantly share code, notes, and snippets.

@tmhrtwg
Created April 26, 2015 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmhrtwg/62248abb16ad26dcbffd to your computer and use it in GitHub Desktop.
Save tmhrtwg/62248abb16ad26dcbffd to your computer and use it in GitHub Desktop.
/* **********************************************
Project 1b: relay switch
The idea is to see if I can control the
relay switch I bought.
********************************************** */
int relay1 = 11;
int relay2 = 10;
int relay3 = 9;
int relay4 = 8;
void setup() {
// debug
// Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
// Set relay pins to output
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
}
void loop() {
digitalWrite(relay1, HIGH);
delay(200);
digitalWrite(relay2, HIGH);
delay(200);
digitalWrite(relay3, HIGH);
delay(200);
digitalWrite(relay4, HIGH);
delay(3000);
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
delay(3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment