Become the Maker you were born to be. Try Arduino Academy for FREE!
There is a 6 pin male header, so you will need a cable or female pins to slide over the header to connect it to your Arduino. Pin 1 connects to Arduino GND, Pins 2-5 to Digital output pins, and Pin 6 to Arduino 5v. A red LED for each relay lights when active (LOW).
int relayPin1 = 7; // IN1 connected to digital pin 7
int relayPin2 = 8; // IN2 connected to digital pin 8
int relayPin3 = 9; // IN3 connected to digital pin 9
int relayPin4 = 10; // IN4 connected to digital pin 10
void setup()
{
pinMode(relayPin1, OUTPUT); // sets the digital pin as output
pinMode(relayPin2, OUTPUT); // sets the digital pin as output
pinMode(relayPin3, OUTPUT); // sets the digital pin as output
pinMode(relayPin4, OUTPUT); // sets the digital pin as output
digitalWrite(relayPin1, HIGH); // Prevents relays from starting up engaged
digitalWrite(relayPin2, HIGH); // Prevents relays from starting up engaged
digitalWrite(relayPin3, HIGH); // Prevents relays from starting up engaged
digitalWrite(relayPin4, HIGH); // Prevents relays from starting up engaged
}
void loop()
{
digitalWrite(relayPin1, LOW); // energizes the relay and lights the LED
digitalWrite(relayPin2, LOW); // energizes the relay and lights the LED
digitalWrite(relayPin3, LOW); // energizes the relay and lights the LED
digitalWrite(relayPin4, LOW); // energizes the relay and lights the LED
delay(1000); // waits for a second
digitalWrite(relayPin1, HIGH); // de-energizes the relay and LED is off
digitalWrite(relayPin2, HIGH); // de-energizes the relay and LED is off
digitalWrite(relayPin3, HIGH); // de-energizes the relay and LED is off
digitalWrite(relayPin4, HIGH); // de-energizes the relay and LED is off
delay(1000); // waits for a second
}
Hi,
may I know what are the values of Resistors and Transistor number.
waiting for a quick reply
Thanks