Go Down

Topic: Latch an OUTPUT in arduino (Read 4485 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy