button and switch

Dr_Ugi:
It sounds like you need to implement a single sketch which checks several inputs and then changes several outputs depending upon their status. With the Arduino running at 16 MHZ, it has plenty of time to check and update many pins thousands of times a second.

The cunning and elegant way to do this would probably be to use a couple of arrays to hold your pin definitions but you have plenty of space so the brute-force way will work perfectly well.

I'm not sure whether you want the output to simply reflect the state of the input (ie to be on when the input relay is closed) or whether you want it to toggle (ie to change state each time there is a short pulse from the relay) For the former you want a sketch that goes along these lines (obviously this is only an outline and not a real sketch):

int inputA = 3;

int inputB = 4;
....
int inputX = X;

int outputA = 9;
int outputB = 10;
...
int outputX = Y;

void setup(){
pinMode(inputA, INPUT);
....
pinMode(inputX, INPUT);

pinMode(outputA, OUTPUT);
...
pinMode(outputX, OUTPUT);

}

void loop(){

if(digitalRead(inputA))digitalWrite(outputA, HIGH);
else digitalWrite(outputA, LOW);
....
if(digitalRead(inputX))digitalWrite(outputX, HIGH);
else digitalWrite(outputX, LOW);

delay(100) // Delay to avoid burning out your relays by switching a thousand times a second! Change this as you wish.

}




For a toggle sketch, you would declare a boolean (true/false) variable for each switch and change the state of that variable (stateA=!stateA;) each time the HIGH and then LOW was detected.

I see that this is very similar to my problem (http://arduino.cc/forum/index.php/topic,149665.0/topicseen.html), How would a boolean for a toggle switch look like? Anyone got experience with this??
Thanx anyway
janjoris