////variables//
//boolean calentador = 2;
//boolean Abanico =3;
//boolean humificador =4;
//boolean luz =5;
//boolean interruptor =6;
//boolean pul_luz=7;
// boolean ON_OF =8;
//boolean programa =9;
//boolean meno =10;
//boolean confing =11;
//boolean mas =12;
//// pulsador ON / OF /
boolean estado01 = HIGH;
unsigned long TA01 =0;
int cont01 =0;
int ON_OF(int pin, int reset, int setet){
pinMode(pin, INPUT_PULLUP);
estado01 =digitalRead(pin);
if(((millis()-TA01)>=300) & (estado01 ==LOW)){
TA01 = millis();
cont01++;
}
if (cont01>=reset){cont01=setet;}
return cont01;
}
//// programa
boolean estado02 = HIGH;
unsigned long TA02 =0;
int cont02 =0;
int progrma (int pin, int reset, int setet){
pinMode(pin, INPUT_PULLUP);
estado02 =digitalRead(pin);
if(((millis()-TA02)>=300) & (estado02 ==LOW)){
TA02 = millis();
cont02++;
}
if (cont02>=reset){cont02=setet;}
return cont02;
}
//// memo y mas
boolean estado03 = HIGH;
unsigned long TA03 =0;
int cont03 =0;
int memo (int pin,int reset, int setet){
pinMode(pin, INPUT_PULLUP);
estado03 =digitalRead(pin);
if(((millis()-TA03)>=300) & (estado03 ==LOW)){
TA03 = millis();
cont03++;
}
if (cont03>=reset){cont03=setet;}
return cont03;
}
//// conf.
boolean estado04 = HIGH;
unsigned long TA04 =0;
int cont04 =0;
boolean estado05 = HIGH;
unsigned long TA05 =0;
int conf (int pin1, int pin2, int reset=2, int setet=0){
pinMode(pin1, INPUT_PULLUP);
estado04 =digitalRead(pin1);
pinMode(pin2, INPUT_PULLUP);
estado04 =digitalRead(pin2);
if(((millis()-TA04)>=300) & (estado04 ==LOW)){
TA04 = millis();
cont04++;
}
if (cont04>=reset){cont04=setet;}
if(((millis()-TA05)>=300) & (estado05 ==LOW)){
TA04-- = millis();
cont04--;
}
if (cont04-->=reset){cont04--=setet;}
return cont04;
}
void setup() {
// put your setup code here, to run once
}
void loop() {
// put your main code here, to run repeatedly:
}