0% found this document useful (0 votes)
21 views4 pages

Progras Practica 1 Parte 2

The document describes several logic gate circuits using Arduino. It defines input pins, output pins, and variables to store the input pin states for AND, OR, NOT, XOR, NAND, and NOR logic gates. The setup function sets the pins as inputs or outputs and the loop function reads the input pins, performs the logic operation, and sets the output pin high or low accordingly.

Uploaded by

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

Progras Practica 1 Parte 2

The document describes several logic gate circuits using Arduino. It defines input pins, output pins, and variables to store the input pin states for AND, OR, NOT, XOR, NAND, and NOR logic gates. The setup function sets the pins as inputs or outputs and the loop function reads the input pins, performs the logic operation, and sets the output pin high or low accordingly.

Uploaded by

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

COMPUERTA AND COMPUERTA OR COMPUERTA NOT

int boton1=2; int boton1=2; int boton1=2;

int boton2=4; int boton2=4; int out= 13;

int out= 13; int out= 13; int condiboton1= 0;

int condiboton1= 0; int condiboton1= 0; void setup() {

int condiboton2= 0; int condiboton2= 0; pinMode (boton1,INPUT);

void setup() { void setup() { pinMode (out,OUTPUT);

pinMode (boton1,INPUT); pinMode (boton1,INPUT); }

pinMode (boton2,INPUT); pinMode (boton2,INPUT); void loop() {

pinMode (out,OUTPUT); pinMode (out,OUTPUT); condiboton1= digitalRead(boton1);

} } if (condiboton1==HIGH) {

void loop() { void loop() { digitalWrite(out, LOW);

condiboton1= digitalRead(boton1); condiboton1= digitalRead(boton1); }

condiboton2= digitalRead(boton2); condiboton2= digitalRead(boton2); else{

if (condiboton1 == HIGH and condiboton2 == if (condiboton1==LOW and condiboton2== digitalWrite(out, HIGH);


HIGH) { LOW) {
}
digitalWrite(out, HIGH); digitalWrite(out, LOW);
}
} }

else{ else{

digitalWrite(out, LOW); digitalWrite(out, HIGH);

} }

} }
COMPUERTA XOR COMPUERTA NAND COMPUERTA NOR

int boton1=2; int boton1=2; int boton1=2;

int boton2=4; int boton2=4; int boton2=4;

int out= 13; int out= 13; int out= 13;

int condiboton1= 0; int condiboton1= 0; int condiboton1= 0;

int condiboton2= 0; int condiboton2= 0; int condiboton2= 0;

void setup() { void setup() { void setup() {

pinMode (boton1,INPUT); pinMode (boton1,INPUT); pinMode (boton1,INPUT);

pinMode (boton2,INPUT); pinMode (boton2,INPUT); pinMode (boton2,INPUT);

pinMode (out,OUTPUT); pinMode (out,OUTPUT); pinMode (out,OUTPUT);

} } }

void loop() { void loop() { void loop() {

condiboton1= digitalRead(boton1); condiboton1= digitalRead(boton1); condiboton1= digitalRead(boton1);

condiboton2= digitalRead(boton2); condiboton2= digitalRead(boton2); condiboton2= digitalRead(boton2);

if (condiboton1 != condiboton2) { if (condiboton1==HIGH and condiboton2== if (condiboton1==LOW and


HIGH) { condiboton2==LOW) {
digitalWrite(out, HIGH);
digitalWrite(out, LOW); digitalWrite(out, HIGH);
}
} }
else{
else{ else{
digitalWrite(out, LOW);
digitalWrite(out, HIGH); digitalWrite(out, LOW);
}
} }
}
} }
+ +
+9VDC
R4=10K C1=1µF
+

BATERIA
R3=10K
R1=1K R5=1M R=?
+9VDC
- -

4011 4011
R1=1M S0
P1=100K 4011

R=?
4011
R2=1K SENSOR

+ +
+9VDC
R4=10K C1=1µF
+

BATERIA
R3=10K
R1=1K R5=1M R=? +9VDC
- -
R1=1M S0
P1=100K 4011 4011 4011

R=?
4011
R2=1K SENSOR

You might also like