Skip to content

Instantly share code, notes, and snippets.

@abhikpal
Created October 13, 2016 06:47
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 abhikpal/03f6827290fcb63e49db67d64d5096f9 to your computer and use it in GitHub Desktop.
Save abhikpal/03f6827290fcb63e49db67d64d5096f9 to your computer and use it in GitHub Desktop.
const int num_relays = 8;
const int relays[] = {2, 3, 4, 5, 6, 7, 8, 9};
const int duration = 1000;
void setup() {
for (int i = 0; i < num_relays; i++) {
pinMode(relays[i], OUTPUT);
digitalWrite(relays[i], HIGH);
}
}
void loop() {
for (int i = 0; i < num_relays; i++) {
digitalWrite(relays[i], HIGH);
delay(duration);
digitalWrite(relays[i], LOW);
delay(duration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment