8 RELES ARDUINO

Buenas!

Soy nueva en esto y quisiera saber si me pueden ayudar modificando un programa, Tengo 8 canales pero quiero que pulsando cada boton del control remoto se active y cuando lo dejo de pulsar se desactive solo.

Aca les dejo el Programa a modificar:

#include <IRremote.h>

int RECV_PIN = 11;
//int OUTPUT_PIN = 2;
int Relay1 = 2;
int Relay2 = 3;
int Relay3 = 4;
int Relay4 = 5;
int Relay5 = 6;
int Relay6 = 7;

IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
//pinMode(OUTPUT_PIN, OUTPUT);
pinMode(Relay1, OUTPUT);
pinMode(Relay2, OUTPUT);
pinMode(Relay3, OUTPUT);
pinMode(Relay4, OUTPUT);
pinMode(Relay5, OUTPUT);
pinMode(Relay6, OUTPUT);
//Serial.begin(9600);
//pinMode(2, OUTPUT);
irrecv.enableIRIn(); // Start the receiver
}
int on = 0;
unsigned long last = millis();

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
if (results.value == 0xFD08F7) { // TIVO button
// If it’s been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 250) {
on = !on;
digitalWrite(Relay1, on ? HIGH :LOW);
}
last = millis();
}
if (results.value == 0xFD8877) { // TIVO button
// If it’s been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 250) {
on = !on;
digitalWrite(Relay2, on ? LOW : HIGH);
}
last = millis();
}
if (results.value == 0xFD48B7) { // TIVO button
// If it’s been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 250) {
on = !on;
digitalWrite(Relay3, on ? LOW : HIGH);
}
last = millis();
}
if (results.value == 0xFD28D7) { // TIVO button
// If it’s been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 250) {
on = !on;
digitalWrite(Relay4, on ? LOW : HIGH);
}
last = millis();
}
if (results.value == 0xFDA857) { // TIVO button
// If it’s been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 250) {
on = !on;
digitalWrite(Relay5, on ? LOW : HIGH);
}
last = millis();
}
if (results.value == 0xFD6897) { // TIVO button
// If it’s been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 250) {
on = !on;
digitalWrite(Relay6, on ? LOW : HIGH);
}
last = millis();
}
if (results.value == 0xFD00FF) { // TIVO button
// If it’s been at least 1/4 second since the last
// IR received, toggle the relay
if (millis() - last > 250) {
on = !on;
digitalWrite(Relay1, on ? HIGH : LOW);
digitalWrite(Relay2, on ? HIGH : LOW);
digitalWrite(Relay3, on ? HIGH : LOW);
digitalWrite(Relay4, on ? HIGH : LOW);
digitalWrite(Relay5, on ? HIGH : LOW);
digitalWrite(Relay6, on ? HIGH : LOW);
}
last = millis();
}
irrecv.resume(); // Receive the next value
}
}

GRACIAS!!!

Hola:

¿Puedes mostrar alguna imagen o esquema de cómo tienes físcamente conectado el módulo de 8 relés?

Si lo conectas directamente, se puede quemar Arduino.

Saludos.