Pages: [1]   Go Down
Author Topic: Latch an OUTPUT in arduino  (Read 3974 times)
0 Members and 1 Guest are viewing this topic.
Chandigarh, India
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Open source lover...!!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is my code :
Code:
// 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);
  }   
}


* Untitled.png (424.84 KB, 1440x859 - viewed 27 times.)
Logged

akesh dhiman

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25884
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Here is my code :
And . . ?
Logged

"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.

Pages: [1]   Go Up
Jump to: