#include "rgb_lcd.h"
#define LCD_NB_COLONNE 16
#define LCD_NB_LIGNE 2
#define LCD_LIGNE1 0
#define LCD_LIGNE2 1
#define LCD_DEBUT_LIGNE 0
#define LCD_DELAI_MSG_DEPART 3000
#define BOUTON 2
#define DELAI_BOUTON 5
rgb_lcd ecranLCD;
void setup() {
/*int i = 99;
ecranLCD.begin(LCD_NB_COLONNE,LCD_NB_LIGNE); // init + clear()
ecranLCD.print("Projet LCD01!");
//ecranLCD.print(i);
ecranLCD.setCursor(LCD_DEBUT_LIGNE, LCD_LIGNE2);
ecranLCD.print("Version 1.0b");
delay(LCD_DELAI_MSG_DEPART);
ecranLCD.clear();
ecranLCD.print("Alarme CSTJ.TI");
ecranLCD.setCursor(LCD_DEBUT_LIGNE, LCD_LIGNE2);
ecranLCD.print("compteur: ");*/
ecranLCD.begin(LCD_NB_COLONNE,LCD_NB_LIGNE);
ecranLCD.print("Alarme TI-CSTJ");
//ecranLCD.print(i);
ecranLCD.setCursor(LCD_DEBUT_LIGNE, LCD_LIGNE2);
ecranLCD.print("Version 1.0b");
delay(LCD_DELAI_MSG_DEPART);
ecranLCD.clear();
ecranLCD.print("temps: ");
ecranLCD.setCursor(8, LCD_LIGNE1);
ecranLCD.print("sec");
ecranLCD.setCursor(LCD_DEBUT_LIGNE, LCD_LIGNE2);
ecranLCD.print("compteur: ");
pinMode(BOUTON, INPUT);
}
void loop() {
//unsigned long int compteur = millis(); // Retourne le temps depuis que le Adruino est démarée
//ecranLCD.setCursor(10, LCD_LIGNE2);
//ecranLCD.print(compteur /* / 1000*/);
unsigned long int temps = millis();
ecranLCD.setCursor(6, LCD_LIGNE1);
ecranLCD.print(temps / 1000);
static unsigned long int compBouton = 0;
int Bouton = digitalRead(BOUTON);
delay(DELAI_BOUTON);
if( Bouton == HIGH)
{
compBouton++;
while(digitalRead(BOUTON))
{
delay(DELAI_BOUTON);
}
}
ecranLCD.setCursor(10, LCD_LIGNE2);
ecranLCD.print(compBouton);
}