Hi! If someone can help me this is the code I'm using to control 2 DC motors for opening swing gates.
But I need to use InputState = digitalRead(D1); as an emergency button is this possible??!
//4 channel EV1527/PT2262 Decoding module
int VCC = 13;//as power vcc
int D3 = 12;
int D2 = 11;
int D1 = 10;
int D0 = 9;
int VT = 8;
int Relay1 = 0;
int Relay2 = 3;
int Relay3 = 2;
int Relay4 = 1;
int InputState = 1; //variable for reading the input status
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin
pinMode(VCC, OUTPUT);
pinMode(D3, INPUT);
pinMode(D2, INPUT);
pinMode(D1, INPUT);
pinMode(D0, INPUT);
pinMode(VT, INPUT);
pinMode(3,OUTPUT);
pinMode(2,OUTPUT);
digitalWrite(VCC, HIGH);//AS VCC
Serial.begin(9600);
delay(2000);//Waiting for rf receiver module startup
}
// the loop routine runs over and over again forever:
void loop() {
InputState = digitalRead(VT);
if(InputState)
{
Serial.print("D3 D2 D1 D0 VT \n");
InputState = digitalRead(D3);
if(InputState) {digitalWrite (3, HIGH); delay(5000); digitalWrite(2, HIGH); delay(28000); digitalWrite(3, LOW); digitalWrite(2, LOW);}
InputState = digitalRead(D2);
if(InputState) {digitalWrite (2, HIGH); delay(5000); digitalWrite(3, HIGH); delay(28000); digitalWrite(2, LOW); digitalWrite(3, LOW);}
InputState = digitalRead(D1);
if(InputState)
InputState = digitalRead(D0);
if(InputState)
}
do{
InputState = digitalRead(VT);
}
while(InputState);
}

