Вы находитесь на странице: 1из 4

UNIVERSIDAD NACIONAL ABIERTA Y A DISTANCIA

MICROPROCESADORES Y MICROCONTROLADORES

APORTE INDIVIDUAL
TRAVBAJO COLABORATIVO 3

PRESENTADO POR:
JULY ESTEFANIA VARGAS MACIAS
CODIGO: 1030647576

PRESENTADO A:
JOAN SEBASTIAN BUSTOS

GRUPO:
309696_43

09 DE MAYO DE 2017
DISEO E IMPLEMENTACIN DE 1 CIRCUITO EN PLATAFORMA ARDUINO

Diseo de un circuito que cense la humedad del suelo y que por medio de un
display visualice el porcentaje de humedad contenida, siendo el rango de 0
voltios en el puerto anlogo como 0% de humedad y siendo 5 voltios en el
puerto anlogo como 100% de humedad (simular la tierra en Proteus con un
potencimetro). -En la programacin colocar un punto de alarma (porcentaje de
humedad) modificable desde 2 pulsadores y que se indique en el display y
encienda un led rojo indicando que la alarma se cumple.
CODIGO IDE ARDUINO:
// constants won't change. They're used here to
// set pin numbers:
const int Pin2 = 2; // the number of the pushbutton pin
const int Pin3 = 3;
const int Pin4 = 4;
const int Pin5 = 5;
const int Pin6 = 6;
const int Motor1A = 12;
const int Motor2A = 13;
// variables will change:
int s1 = 0;
int s2 = 0; // variable for reading the pushbutton status
int s3 = 0;
int s4 = 0;
int s5 = 0;

void setup() {
// initialize the LED pin as an output:
pinMode(Motor1A, OUTPUT);
pinMode(Motor2A, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(Pin2, INPUT);
pinMode(Pin3, INPUT);
pinMode(Pin4, INPUT);
pinMode(Pin5, INPUT);
pinMode(Pin6, INPUT);
}
void loop() {
// read the state of the pushbutton value:
s1 = digitalRead(Pin2);
s2 = digitalRead(Pin3);
s3 = digitalRead(Pin4);
s4 = digitalRead(Pin5);
s5 = digitalRead(Pin6);

// check if the pushbutton is pressed.


// if it is, the buttonState is HIGH:
if ((s3 == LOW)&&(s1 == HIGH)&&(s2 == HIGH)&&(s4 == HIGH)&&(s5
== HIGH))
{
digitalWrite(Motor1A, LOW);
digitalWrite(Motor2A, HIGH);
}
else if((s2 == HIGH)||(s1 == HIGH))
{
digitalWrite(Motor2A, HIGH);
digitalWrite(Motor1A, LOW);
}
else if((s4 == HIGH)||(s5 == HIGH)){
digitalWrite(Motor2A,HIGH);
digitalWrite(Motor1A, LOW);
}
}

Вам также может понравиться