//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
int bpplus = 11 ;
int bpmoins = 10 ;
int bp = 9 ;
//unsigned long startTime;
//unsigned long currentTime;
//const unsigned long period = 10000;
//unsigned long temps = 0;
long previousMillis = 0;
long interval = 5000;
int x ;
int a;
/*class Opperation {
public :
int a ;
int getc(){
return c ;
}
void mul (int _a );
private :
int c;
};
void Opperation::mul (int _a );
{
c=_a;
}*/
void setup()
{
pinMode(bp,INPUT) ;
pinMode(bpplus,INPUT) ;
pinMode(bpmoins,INPUT) ;
// startTime = millis();
Serial.begin(9600);
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
}
void bvn()
{
lcd.setCursor(3,0);
lcd.print("Bienvenue");
lcd.setCursor(3,1);
lcd.print("en BTS SN");
}
void valid()
{
lcd.setCursor(0,0);
lcd.print(x);
lcd.setCursor(3,0);
lcd.print("personnes");
lcd.setCursor(3,1);
lcd.print("ont valide");
lcd.init();
}
void loop()
{
bvn();
unsigned long currentMillis = millis(); // stocke la valeur courante de la fonction millis()
if (currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
valid();
/* if ( bvn() =HIGH)
{
valid();
}*/
}
/*else // sinon
// Met la sortie ledPIN au NL0 ( diode éteinte)
valid() = HIGH;
/* lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
/*
lcd.setCursor(3,0);
lcd.print("Bienvenue");
lcd.setCursor(3,1);
lcd.print("en BTS SN");
delay(5000);*/
/* lcd.setCursor(0,0);
lcd.print(x);
lcd.setCursor(3,0);
lcd.print("personnes");
lcd.setCursor(3,1);
lcd.print("ont valide");
//delay(5000);*/
boolean etatbp = digitalRead(bp) ;
if (etatbp==HIGH)
{
a++;
delay(500);
}
boolean etat = digitalRead(bpplus) ;
if (etat==HIGH)
{
a--;
delay(500);
}
boolean ett = digitalRead(bpmoins) ;
if (ett==HIGH)
{
x=a;
}
if (a<0)
{
a=0;
}
/*while(millis() - temps < 9000){
lcd.setCursor(0,0);
lcd.print(x);
lcd.setCursor(3,0);
lcd.print("personnes");
lcd.setCursor(3,1);
lcd.print("ont valide");
temps = millis();
}*/
/*while(millis() - temps > 10000){
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Bienvenue");
lcd.setCursor(3,1);
lcd.print("en BTS SN");
temps = millis();
delay(5000);
}*/
//currentTime = millis();
/* if (currentTime - startTime >= period)
lcd.setCursor(0,0);
lcd.print(x);
lcd.setCursor(3,0);
lcd.print("personnes");
lcd.setCursor(3,1);
lcd.print("ont valide");*/
/*currentTime=millis();
if((currentTime-previousTime)>=5000){
previousTime=currentTime;
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Bienvenue");
lcd.setCursor(3,1);
lcd.print("en BTS SN");
}
/* */
// delay();
Serial.print("a = ");
Serial.print(a);
}