Hi tom, yes... i think i have all understood.

- A0 to a opened detector switch installed on roof, the connection will be... from switch detector to GND pin on arduino board and from arduino board A0 pin to NO or NC switch detector.
- A1 to a closed detector switch installed on roof, the connection will be... from switch detector to GND pin on arduino board and from arduino board A1 pin to NO or NC switch detector.

I have been doing some test at home and its work.

By the way, i change my own code in arduino because ii want 1 relay to open/close and another relay to stop motor
// Indirection to define a functional name in terms of a relay
// Use 0 if function not supportd
#define FUNC_OPEN RELAY_1
#define FUNC_CLOSE RELAY_1 // For a single button controller might map this also to RELAY_1
#define FUNC_STOP RELAY_2 // For a single button controller might map this also to RELAY_1
#define FUNC_LOCK 0 // If automated roof lock is available.
#define FUNC_AUX 0 // Relay to perform some unspecified function

And too, setup the relays to start as LOW mode:

void setRelay(int id, int hold, char* value)
{
if (strcmp(value, "ON") == 0)
{
digitalWrite(id, HIGH); // NO RELAY would normally already be in this condition (open)
delay(RELAY_PRIOR_DELAY);
digitalWrite(id, LOW); // Activate the NO relay (close it)
if (hold == 0)
{
delay(RELAY_ON_DELAY);
digitalWrite(id, HIGH); // Turn NO relay off
}
}
else
{
digitalWrite(id, HIGH); // Turn NO relay off
}
delay(RELAY_POST_DELAY);
}

void setup()
{
// Initialize the input switches
pinMode(SWITCH_1, INPUT_PULLUP);
pinMode(SWITCH_2, INPUT_PULLUP);
pinMode(SWITCH_3, INPUT_PULLUP);
pinMode(SWITCH_4, INPUT_PULLUP);

// Initialize the relays
//Pin Setups
pinMode(RELAY_1, OUTPUT);
pinMode(RELAY_2, OUTPUT);
pinMode(RELAY_3, OUTPUT);
pinMode(RELAY_4, OUTPUT);

//Turn Off the relays.
digitalWrite(RELAY_1, HIGH);
digitalWrite(RELAY_2, HIGH);
digitalWrite(RELAY_3, HIGH);
digitalWrite(RELAY_4, HIGH);


// Establish USB port.
Serial.begin(BAUD_RATE); // Baud rate to match that in the driver
}
I am now starting to understand the arduino code from rolloff ino...

Thanks again, i will contact again if i need some question more.
Regards.

Read More...