0% found this document useful (0 votes)
18 views

F2019266364 Muhammad Rizwan Final Task1:: (Binary Addition)

The document describes an Arduino code and circuit for binary addition. The code defines pins for the inputs of the first and second binary numbers and outputs of the sum. It sets the pins as inputs or outputs in setup and performs the binary addition in loop by reading the pin values and writing results to the output pins.

Uploaded by

Rizwan Khadim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

F2019266364 Muhammad Rizwan Final Task1:: (Binary Addition)

The document describes an Arduino code and circuit for binary addition. The code defines pins for the inputs of the first and second binary numbers and outputs of the sum. It sets the pins as inputs or outputs in setup and performs the binary addition in loop by reading the pin values and writing results to the output pins.

Uploaded by

Rizwan Khadim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

F2019266364 Muhammad Rizwan

Final

Task1:
{Binary Addition}
Arduino Code:

//For 1st Binary


int pin13=13;
int pin12=12;

//For 2nd Binary


int pin10=10;
int pin9=9;

//For sum
int pin7=7;
int pin6=6;
int pin5=5;

void setup() {
pinMode(pin13,INPUT);
pinMode(pin12,INPUT);

//
pinMode(pin10,INPUT);
pinMode(pin9,INPUT);

//
pinMode(pin7,OUTPUT);
pinMode(pin6,OUTPUT);
pinMode(pin5,OUTPUT);

void loop() {
//For seg1
int A=digitalRead(pin13);
int B=digitalRead(pin12);

//For seg2
int L=digitalRead(pin10);
int M=digitalRead(pin9);
int Out=A^L;
int Bor=A&L;

digitalWrite(pin7,A^L);

digitalWrite(pin6,Bor^B^M);

digitalWrite(pin5,B&M);

Circuit:

You might also like