/Logical-operation

To perform logical operation using Arduino Controller

GNU General Public License v3.0GPL-3.0

Logical Operation

Jhagan B
CSE - 212220040066

AIM:

To Perform logical operation using Arduino UNO Controller.

Software required:

Arduino IDE
Proteous

PROCEDURE:

Arduino IDE

Step1:Open the Arduino IDE
Step2: Go to file and select new file option
Step3:Type the program
Step4:Go to file and select save option to save the program
Step5:Go to sketch and select verify or compile options
Step6:If no error Hex file will be generated in the temporary folder

Proteus

Step7:Open the Proteus software
Step8:Go to file select new design and click ok button
Step9:Select component mode and click pick devices from the library
Step10:Type the component name in the keyword to select the components and click ok button
Step11:Design the circuit as per the diagram
Step12:Double click the Arduino controller and upload the hex file generated by Arduino IDE
Step13:Click start button and check the output

THEORY:

Logic gates are the basic building blocks of any digital system. It is an electronic circuit having one or more than one input and only one output. The relationship between the input and the output is based on a certain logic. Based on this, logic gates are named as AND gate, OR gate, NOT gate etc.

image

image

image

image

image

image

image

PROGRAM:

int bs0 = 0;         // variable for reading the pushbutton status
int bs1 = 0;
int bs2 = 0;         // variable for reading the pushbutton status
int bs3 = 0;
int bs4 = 0;         // variable for reading the pushbutton status
int bs5 = 0;
void setup() {
  pinMode(13, OUTPUT);
  pinMode(0, INPUT);
  pinMode(1, INPUT);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
}
void loop() {

  bs0 = digitalRead(0);
  bs1 = digitalRead(1);
  bs2 = digitalRead(2);
  bs3 = digitalRead(3);
  bs4 = digitalRead(4);
  bs5 = digitalRead(5);

  if (bs4 == 0 && bs5 == 0) 
  {
      digitalWrite(13, bs0);
  } 
  else if (bs4 == 0 && bs5 == 1) 
  {
    
    digitalWrite(13, bs1);
  }
   else if (bs4 == 1 && bs5 == 0) 
  {
    
    digitalWrite(13, bs2);
  }
   else   if (bs4 == 1 && bs5 == 1) 
  {
      digitalWrite(13, bs3);
  } 
}

CIRCUIT DIAGRAM:

272861852-cb6584a9-1c4a-4701-96bf-9479581d8680

OUTPUT:

272861974-e247446a-2648-41e2-b3b3-d53b684b45e5

RESULT:

Thus the logical operation was performed by Arduino UNO controller