4-Channel 5V Relay Module Expansion Board for Arduino

From air
Jump to navigation Jump to search

4-Channel 5V Relay Module Expansion Board for Arduino.jpg

http://dx.com/p/arduino-4-channel-5v-relay-module-expansion-board-137109


// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(2, OUTPUT);  // relay 1   
  pinMode(3, OUTPUT);  // relay 2     
  pinMode(4, OUTPUT);  // relay 3     
  pinMode(5, OUTPUT);  // relay 4     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(2, HIGH);   // turn the relay 1 on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(2, LOW);    // turn the relay 1 off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(3, HIGH);   // turn the relay 2 on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(3, LOW);    // turn the relay 2 off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(4, HIGH);   // turn the relay 3 on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(4, LOW);    // turn the relay 3 off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(5, HIGH);   // turn the relay 4 on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(5, LOW);    // turn the relay 4 off by making the voltage LOW
  delay(1000);               // wait for a second
}