Go Down

Topic: Latch an OUTPUT in arduino (Read 4390 times) previous topic - next topic

akkku

Here is my code :
Code: [Select]
// Arduino INPUTS
int remote1 = 12; // Connected to DAQ's DO0
int remote2 = 11; // Connected to DAQ's DO1
int doorclosed = 10; // Connected to DAQ's DO2
int dooropened = 9; // Connected to DAQ's DO3
// Arduino OUTPUTS
int dooropen = 7; // Connected to DAQ's DI0
int doorclose = 6; // Connected to DAQ's DI1

void setup()
{
  pinMode(remote1, INPUT);
  pinMode(remote2, INPUT);
  pinMode(doorclosed, INPUT); 
  pinMode(dooropened, INPUT);   
  pinMode(doorclose, OUTPUT); 
  pinMode(dooropen, OUTPUT);   
}

void loop()
{
  if(digitalRead(remote1) == HIGH )
   {
    digitalWrite(dooropen, HIGH);
  }
 
  if(digitalRead(remote2) == HIGH )
{
    digitalWrite(doorclose, HIGH); 
  }
   
  if(digitalRead(dooropened) == HIGH )
   {
    digitalWrite(dooropen, LOW);
  } 
 
  if(digitalRead(doorclosed) == HIGH )
   {
    digitalWrite(doorclose, LOW);
  }   
}

akesh dhiman

AWOL

Quote
Here is my code :

And . . ?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up