All submissions

Logic Gate Implementation

Solving Approach

How do you plan to solve it?

Just using the inbuilt bitwise operator symbols such as ||,&&,!
just implementing the AND logic by using the &&
implementing OR logic with ||
implementing NOR with !(A||B)
implementing NAND with !(A&&B)

 
 

 

 

 

Code

#define BT1 13
#define BT2 12
#define L1 8
#define L2 7
#define L3 6
#define L4 2
void setup(){
 pinMode(BT1,INPUT_PULLUP);
  pinMode(BT2,INPUT_PULLUP);
  pinMode(L1,OUTPUT);
  pinMode(L2,OUTPUT);
  pinMode(L3,OUTPUT);
  pinMode(L4,OUTPUT);
  Serial.begin(115200);
}
void loop(){
 int st1=digitalRead(BT1);
 int st2=digitalRead(BT2);
  Serial.print(st1);
  Serial.println(st2);
   digitalWrite(L1,st1 && st2); 
   digitalWrite(L2,st1 || st2); 
   digitalWrite(L3,!(st1 && st2));
   digitalWrite(L4,!(st1 || st2)); 
  delay(500);
}



 

 

 

Output

Video

Add a video of the output (know more)

 

 

 

 

Submit Your Solution

Note: Once submitted, your solution goes public, helping others learn from your approach!