//Programa: 1B_Control_pulsaciones...........................................................//
//Autor: Jhon sebastian porras.........................................................//
#include <LiquidCrystal_PCF8574.h>
LiquidCrystal_PCF8574 lcd(0x27);
int s1=0;
int s2=0;
int estado1;
int estado2;
int estado3;
#define P1 27
#define P2 16
#define P3 17
void setup(){
pinMode(P1,INPUT_PULLUP);
pinMode(P2,INPUT_PULLUP);
pinMode(P3,INPUT_PULLUP);
lcd.begin(16,2);
lcd.setBacklight(250);
lcd.setCursor(1,0);
lcd.print("Pulse Px para");
lcd.setCursor(4,1);
lcd.print("Comenzar");
}
void loop(){
estado1=digitalRead(P1);
estado2=digitalRead(P2);
estado3=digitalRead(P3);
if(estado1==LOW || estado2==LOW || estado3==LOW){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("P1( ): seg");
lcd.setCursor(6,0);
lcd.print(s1);
lcd.setCursor(0,1);
lcd.print("P2( ): seg");
lcd.setCursor(6,1);
lcd.print(s2);
if (estado1 == LOW) {
s1++;
lcd.setCursor(3,0);
lcd.print("*");
lcd.setCursor(6,0);
lcd.print(s1);
delay(1000);
}
if (estado2 == LOW) {
s2++;
lcd.setCursor(3,1);
lcd.print("*");
lcd.setCursor(6,1);
lcd.print(s2);
delay(1000);
}
if (estado3 == LOW) {
s1 = 0;
s2 = 0;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("P1( ): seg");
lcd.setCursor(6,0);
lcd.print(s1);
lcd.setCursor(0,1);
lcd.print("P2( ): seg");
lcd.setCursor(6,1);
lcd.print(s2);
delay(1000);
}
}
delay(100);
}//end loop