Pentru a verifica rapid functionarea unui asemenea modul, avand la dispozitie decat o placa Arduino si niste fire Dupont, am facut un mic montaj:
iar ca sketch, am folosit ca baza pe cel numit "Blink" din exemplele programului Arduino IDE.
Am facut un filmulet, numit test placa cu 2 relee in care apare un Arduino Mega, care este conectat la fel (D8 si D9).
iar sketch-ul folosit este:
/*
"Blink" is original sketch
changed sketch by niq_ro for test 2 relay board
http://nicuflorica.blogspot.ro/
http://www.tehnic.go.ro
http://www.niqro.3x.ro
http://arduinotehniq.blogspot.com/
*/
// inputs for relays:
int pin1 = 7; // D7 for relay 1
int pin2 = 8; // D8 for relay 2
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
digitalWrite(pin1, LOW); // turn the relay 1 off by making the voltage LOW
digitalWrite(pin2, LOW); // turn the relay 2 off by making the voltage LOW
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(pin1, HIGH); // turn the relay 1 on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(pin1, LOW); // turn the relay 1 off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(pin2, HIGH); // turn the relay 2 on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(pin2, LOW); // turn the relay 2 off by making the voltage LOW
delay(1000); // wait for a second
}
