Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

EXPERIMENT- 4

AND GATE WITH ARDUINO


Aim
To study the operation of AND gate by using Arduino development board.

Electrical Components and Software


1. Arduino board
2. Two switches
3. Light Emitting Diode (LED)
4. Proteus Software
5. Arduino IDE

Theory
An AND gate is a logic gate having two or more inputs and a single output. An AND gate
operates on logical multiplication rules. In this gate, if either of the inputs is LOW, then the
output is also LOW. If all of the inputs are HIGH, then the output will also be HIGH.

int C=4; int A=2; int B=3; ARDUINO UNO V3


void setup()
{
pinMode(C, OUTPUT); pinMode(A,
INPUT); pinMode(B, INPUT);
Reset

USB
13
} PB5/SCK
PB4/MISO
12
C
11
void loop() ~ PB3/MOSI/OC2A
ARDUINO

10
~ PB2/OC1B
9
{ ~ PB1/OC1A
8
AT MEGA328P-PU

PB0/ICP1/CLKO
int A=digitalRead (A); int B
1121

7
PD7/AIN1
B=digitalRead (B); if(A==0 && A0 ~ PD7/AIN1
6
5
PC0/ADC0
B==0) { A1
A2
PC1/ADC1
~ PD5/T1/OC0B
PD4/T0/XCK
4
3
PC2/ADC2
digitalWrite(C, HIGH); A3
PC3/ADC3
~ PD3/INT1/OC2B
PD2/INT0
2
A4 1
} else A5
PC4/ADC4/SDA PD1/TXD
0
A(2)

PC5/ADC5/SCL PD0/RXD
{ by TEP

digitalWrite(C, LOW); A
}}
Figure 1. Source Code Procedure Figure 2. Circuit diagram

Procedure
1. To download and installed Arduino IDE software which write C programming language.
2. To download and installed Proteus software which simulate the hardware components.
3. To add Arduino Library to Proteus software.
4. To draw circuit diagram on Proteus software.
5. To write the source code on Arduino IDE software.
6. To verify the source code and add hex file to upload hex file on Proteus software.
7. To run the connecting components.
8. To investigate the circuit how to stimulate the system.

Table 1. Measuring the output of the AND gate with Arduino board

INPUTS OUTPUT
A B C
HIGH HIGH
HIGH LOW
LOW HIGH
LOW LOW

You might also like